Kasas Kasas - 9 months ago 85
Android Question

IsProviderEnabled for GPS is not working

we have implemented a geobased app for Android, so we need to ensure GPS is enabled all the time. The problem is that

manager.isProviderEnabled( LocationManager.GPS_PROVIDER )

is always returning false even if the GPS Provider is enabled, so our app is always showing the alert to change the GPS status or it is not working.

Do you know what is happening?

We are testing it with a Samsung Galaxy S and a HTC Wildfire device...
Thanks in advance.


You can get GPS status directly from system:

LocationManager myLocationManager = (LocationManager)  getSystemService(Context.LOCATION_SERVICE);

private boolean getGPSStatus()
   String allowedLocationProviders =

   if (allowedLocationProviders == null) {
      allowedLocationProviders = "";

   return allowedLocationProviders.contains(LocationManager.GPS_PROVIDER);