How do I unsubscribe LocationListenerfrom updates LocationManager?
This is how I configure it
mLocationManager = (LocationManager)this.getSystemService(LOCATION_SERVICE);
mListener = new LocationListener() {
public void onLocationChanged(Location location) {
Log.i("LocationListener", "Logging Change");
}
}
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
5000, 1, mListener);
After I left the view that created LocationListener, I still get the log messages in the LogCat window.
I understand that this is because I am an orphan of a listener, but I don’t see any destroy method in LocationListener, and I don’t see any delete listener style methods in the object LocationManager.
source
share