Cleaned Up code related to broadcasting and receving locations updates

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-05-16 10:41:53 -04:00
parent ff27eb8ae3
commit fa9985aed5
7 changed files with 31 additions and 70 deletions

View File

@@ -0,0 +1,40 @@
/**
* @author Twenty Codes, LLC
* @author ricky barrette
* @date Oct 18, 2010
*/
package com.TwentyCodes.android.location;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
/**
* this abstract class will be used as a for classes wishing to be a receiver of location updates from the location services
* @author ricky barrette
*/
public abstract class BaseLocationReceiver extends BroadcastReceiver {
public Context mContext;
/**
* (non-Javadoc)
* @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
*/
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
final String key = LocationManager.KEY_LOCATION_CHANGED;
if (intent.hasExtra(key))
onLocationUpdate((Location)intent.getExtras().get(key));
}
/**
* called when a location update is received
* @param parcelableExtra
* @author ricky barrette
*/
public abstract void onLocationUpdate(Location location);
}