I think I'm doing it right?
I have this code that starts searching for my GPS location using the MyLocationListener method, which does not appear here, that works, but I want to stop the locationManager onPause, I think, or when this action is not current, but I cannot get the removeUpdates code for solutions.
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, new MyLocationListener());
and then
@Override
public void onPause()
{
super.onPause();
locationManager.removeUpdates(MyLocationListener);
}
"MyLocationListener" will not allow, Ive also tried "this" and,
locationManager.removeUpdates((LocationListener) this);
Which solves, but gives me a "Can not Pause" error at runtime.
user903601
source
share