com.TwentyCodes.android.location
Class LocationService

java.lang.Object
  extended by Service
      extended by com.TwentyCodes.android.location.LocationService

public class LocationService
extends Service

this service class will be used broadcast the users location periodic

Author:
ricky barrette

Field Summary
static String PERIOD_BETWEEN_UPDATES
           
static String TAG
           
 
Constructor Summary
LocationService()
           
 
Method Summary
 IBinder onBind(Intent arg0)
          (non-Javadoc)
 void onCreate()
          called when the service is created.
 void onDestroy()
          called when the service is destroyed.
 void onLocationChanged(Location location)
          (non-Javadoc)
 void onProviderDisabled(String arg0)
          (non-Javadoc)
 void onProviderEnabled(String arg0)
          (non-Javadoc)
 void onStart(Intent intent, int startId)
          To keep backwards compatibility we override onStart which is the equivalent of onStartCommand in pre android 2.x
 int onStartCommand(Intent intent, int flags, int startId)
          This method is called when startService is called.
 void onStatusChanged(String arg0, int arg1, Bundle arg2)
          (non-Javadoc)
static Runnable startService(Context context, long period)
          a convince method for starting the service.
static Runnable stopService(Context context)
          a convince method for stopping the service
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

public static final String TAG
See Also:
Constant Field Values

PERIOD_BETWEEN_UPDATES

public static final String PERIOD_BETWEEN_UPDATES
See Also:
Constant Field Values
Constructor Detail

LocationService

public LocationService()
Method Detail

onCreate

public void onCreate()
called when the service is created. this will initialize the location manager, and acquire a wakelock (non-Javadoc)

See Also:
Service

onDestroy

public void onDestroy()
called when the service is destroyed. this will remove any wakelock or location service running, and register to be waken back up (non-Javadoc)

See Also:
Service

onLocationChanged

public void onLocationChanged(Location location)
(non-Javadoc)

Parameters:
location -
See Also:
LocationListener

onProviderDisabled

public void onProviderDisabled(String arg0)
(non-Javadoc)

Parameters:
arg0 -
See Also:
LocationListener

onProviderEnabled

public void onProviderEnabled(String arg0)
(non-Javadoc)

Parameters:
arg0 -
See Also:
LocationListener

onStart

public void onStart(Intent intent,
                    int startId)
To keep backwards compatibility we override onStart which is the equivalent of onStartCommand in pre android 2.x


onStartCommand

public int onStartCommand(Intent intent,
                          int flags,
                          int startId)
This method is called when startService is called. only used in 2.x android.


onStatusChanged

public void onStatusChanged(String arg0,
                            int arg1,
                            Bundle arg2)
(non-Javadoc)

Parameters:
arg0 -
arg1 -
arg2 -
See Also:
LocationListener

onBind

public IBinder onBind(Intent arg0)
(non-Javadoc)

Parameters:
arg0 -
Returns:
See Also:
Service

startService

public static Runnable startService(Context context,
                                    long period)
a convince method for starting the service. 1 minute = 60 000 milliseconds

Parameters:
context -
period - between updates in milliseconds
Returns:
a runnable that will start the service

stopService

public static Runnable stopService(Context context)
a convince method for stopping the service

Parameters:
context -
Returns:
a runnable that will stop the service