I have a service to update location in my app. When I start my app with GPS disable, go back to android menu and enable GPS, and finally go back to my app (the service has n
In your LocationService.onCreate()
method your code checks if the GPS provider is disabled.
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){...}
But you only start the subscription if it is already enabled. Note that your listener is then never registered with the LocationManager
and will not receive any updates of location providers being disabled or enabled. Rather change your onCreate()
method to always call
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5 * 60 * 1000, 100, this);