From 4c624a34e347e859fb5172e04208ecac10fc8c83 Mon Sep 17 00:00:00 2001 From: ricky barrette Date: Mon, 31 Jan 2011 17:04:56 +0000 Subject: [PATCH] LocationService.java i moved the broadcastLocation() call to onDestroy(), and replace all previous calls with kstopSelf(mStartId); --- .../com/TwentyCodes/android/TravelPost/LocationService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java index c0c2270..4eb0474 100644 --- a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java +++ b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java @@ -53,7 +53,7 @@ public class LocationService extends Service implements LocationListener { private Runnable mFailSafe = new Runnable() { @Override public void run(){ - broadcastLocation(); + stopSelf(mStartId); } }; @@ -94,7 +94,6 @@ public class LocationService extends Service implements LocationListener { locationUpdate.setAction(LocationReceiver.ACTION_UPDATE); locationUpdate.putExtra(LocationReceiver.LOCATION_PARCEL, mLocation); sendBroadcast(locationUpdate); - stopSelf(mStartId); } } @@ -148,6 +147,7 @@ public class LocationService extends Service implements LocationListener { */ @Override public void onDestroy(){ + broadcastLocation(); mLocationManager.removeUpdates(this); mNotificationManager.cancel(SIMPLE_NOTFICATION_ID); if(mWakeLock.isHeld()) @@ -165,7 +165,7 @@ public class LocationService extends Service implements LocationListener { // Log.d(TAG, "got location +- "+ location.getAccuracy() +"m"); mLocation = location; if(location.getAccuracy() <= DESIRED_ACCURACY){ - broadcastLocation(); + stopSelf(mStartId); } }