Created
          February 17, 2012 15:51 
        
      - 
      
- 
        Save meeDamian/1854112 to your computer and use it in GitHub Desktop. 
    Service in TabActivity - Service
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package com.example.app.services; | |
| import java.net.MalformedURLException; | |
| import java.net.URL; | |
| import android.app.Service; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.net.ConnectivityManager; | |
| import android.net.NetworkInfo; | |
| import android.os.Binder; | |
| import android.os.IBinder; | |
| import android.util.Log; | |
| public class LocalService extends Service { | |
| private final IBinder mBinder = new LocalBinder(); | |
| public class LocalBinder extends Binder { | |
| public LocalService getService() { | |
| return LocalService.this; | |
| } | |
| } | |
| @Override | |
| public void onCreate() { | |
| super.onCreate(); | |
| } | |
| // called only on pre-2.0 systems | |
| @Override | |
| public void onStart(Intent intent, int startId) { | |
| } | |
| // called on 2.0+ systems | |
| @Override | |
| public int onStartCommand(Intent intent, int flags, int startId) { | |
| return START_STICKY; | |
| } | |
| @Override | |
| public IBinder onBind(Intent intent) { | |
| return mBinder; | |
| } | |
| @Override | |
| public boolean onUnbind(Intent intent) { | |
| return true; | |
| } | |
| public void onDestroy() { | |
| } | |
| public String pastafarianism() { | |
| return "I love Pasta!"; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment