Commit e707048d authored by Chris Scott's avatar Chris Scott

Found the removeProximityAlert causes error if none are added already. must...

Found the removeProximityAlert causes error if none are added already.  must be careful about removing these
parent 635a32ab
...@@ -363,9 +363,6 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -363,9 +363,6 @@ public class LocationUpdateService extends Service implements LocationListener {
stationaryLocation = location; stationaryLocation = location;
locationManager.removeUpdates(this); locationManager.removeUpdates(this);
// Remove previous stationaryRegionPI just in case.
locationManager.removeProximityAlert(stationaryRegionPI);
// Here be the execution of the stationary region monitor // Here be the execution of the stationary region monitor
locationManager.addProximityAlert( locationManager.addProximityAlert(
location.getLatitude(), location.getLatitude(),
...@@ -564,12 +561,19 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -564,12 +561,19 @@ public class LocationUpdateService extends Service implements LocationListener {
} }
private void cleanUp() { private void cleanUp() {
locationManager.removeUpdates(this); locationManager.removeUpdates(this);
locationManager.removeProximityAlert(stationaryRegionPI);
alarmManager.cancel(stationaryAlarmPI); alarmManager.cancel(stationaryAlarmPI);
unregisterReceiver(stationaryAlarmReceiver); unregisterReceiver(stationaryAlarmReceiver);
unregisterReceiver(stationaryRegionReceiver); unregisterReceiver(stationaryRegionReceiver);
unregisterReceiver(singleUpdateReceiver); unregisterReceiver(singleUpdateReceiver);
if (stationaryLocation != null && !isMoving) {
try {
locationManager.removeProximityAlert(stationaryRegionPI);
} catch (Throwable e) {
Log.w(TAG, "- Something bad happened while removing proximity-alert");
}
}
wakeLock.release(); wakeLock.release();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment