From 6fcc65a60591f76ad73d5bbcbf7342f137f10998 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Sat, 21 Jul 2012 22:38:38 -0400 Subject: [PATCH] Cleaned up some code in the Location service and android gps classes --- LocationLib/AndroidManifest.xml | 2 +- .../android/location/AndroidGPS.java | 8 ------ .../android/location/LocationService.java | 28 ++----------------- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/LocationLib/AndroidManifest.xml b/LocationLib/AndroidManifest.xml index df6d148..600c4d4 100644 --- a/LocationLib/AndroidManifest.xml +++ b/LocationLib/AndroidManifest.xml @@ -16,7 +16,7 @@ + android:targetSdkVersion="16" />
PendingIntent pendingIntent = PendingIntent.getService(context, 0, LocationService.startService(context), 0);
- * or
- * Intent service = new Intent(context, LocationService.class);
- * context.startService(service);

- * To use as a recurring service:
- * 
LocationService.startService(this, (60000 * Integer.parseInt(ringer.getString(UPDATE_INTVERVAL , "5")))).run(); * @author ricky barrette */ public class LocationService extends Service implements LocationListener { @@ -65,7 +57,7 @@ public class LocationService extends Service implements LocationListener { }; } private WakeLock mWakeLock; - private long mPeriod = -1; + protected long mPeriod = -1; private Location mLocation; private int mStartId; private AndroidGPS mLocationManager; @@ -97,7 +89,7 @@ public class LocationService extends Service implements LocationListener { locationUpdate.setAction(mIntent.getAction()); else locationUpdate.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); - locationUpdate.putExtra(LocationManager.KEY_LOCATION_CHANGED, mLocation); + locationUpdate.putExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED, mLocation); sendBroadcast(locationUpdate); stopSelf(mStartId); } @@ -174,21 +166,6 @@ public class LocationService extends Service implements LocationListener { } - /** - * To keep backwards compatibility we override onStart which is the equivalent of onStartCommand in pre android 2.x - * @author ricky barrette - */ - @Override - public void onStart(final Intent intent, final int startId) { - if(Debug.DEBUG) - Log.i(TAG, "onStart.Service started with start id of: " + startId); - mStartId = startId; - - parseIntent(intent); - - mLocationManager.enableLocationUpdates(this); - } - /** * This method is called when startService is called. only used in 2.x android. * @author ricky barrette @@ -208,7 +185,6 @@ public class LocationService extends Service implements LocationListener { @Override public void onStatusChanged(final String provider, final int status, final Bundle extras) { // TODO Auto-generated method stub - } /**