I have location updates set on my app like such
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 6000, 100, this);
Which has been working fine. But my issue is since the code is in OnResume it notifies you and your phone beeps ('Finding location') whenever bouncing back to the activity (multi-activity app so quite often) which is annoying
So my question is: Is it safe to remove location updates in OnDestroy? and if not where would I put them?
I know OnDestroy isn't called all the time. If it isn't will it never stop updating the users location and wasting battery?
I don't want to have it keep annoying users so I made updates not get destroyed on pause. That way if you go to a new activity it won't re-notify you. Thanks
@Override
public void onDestroy() {
if (locationManager != null) {
locationManager.removeUpdates(this);
}
}