Stop GPS Listener from Pining GPS: Android

When an activity has a registered a LocationListener, sometimes when the back button is pressed the listener does not stop pinging the GPS, draining the battery life. We can stop this by overwriting the onPause() method of that activity like so.

@Override
	protected void onPause() {
		locationManager.removeUpdates(locationListener);
		super.onPause();
	}



1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *