This is my code that behaves a bit 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 displays a dialog that asks if GPS must be enabled (for example this ).
Everything wokr is fine, unless I start Activity with GPS turned off and click "No" in the showNoGPSWarning() dialog box. Then my application does not listen to GPS changes at all.
If I turn it on, nothing will happen. The Google Maps API is not trying to receive a GPS signal. If I disable it, nothing will happen again, onProviderDisabled() not called.
As I said, this is the only way that happens if I click "Yes" in the dialog box in which it works.
So how does my dialogue affect the behavior of my application ?.
source share