This is my code that behaves a little strange:
locationOverlay = new MyLocationOverlay(this, map) {
@Override
public void onLocationChanged(Location location) {
super.onLocationChanged(location);
updatePosition(locationOverlay.getMyLocation());
}
@Override
public void onProviderDisabled(String provider) {
if(provider.equals(LocationManager.GPS_PROVIDER))
showNoGPSWarning();
}
};
showNoGPSWarning
shows a Dialog that asks if GPS should be enabled (like this).
Everything wokrs perfectly fine except if I start the Activity with GPS disabled and press "No" in the showNoGPSWarning()
dialog. Then my App doesn't listen to GPS changes at all.
If I turn it on, nothing happens. The Google maps API doesn't try to get a GPS signal. If I turn it back off, nothing happens again, onProviderDisabled()
is not called.
As I said, this is the only way that happens, if I press "Yes" in the dialog it works.
So how is my dialog affecting the behavior of my App?.