Android Location API: Get Provider Status

What is the best way to get provider status in Android? When registering a LocationListener for location updates, a callback onStatusChanged(String provider, int status, Bundle extras)will be called whenever the status changes. However, I have not found a way to get the current status of ( AVAILABLE, OUT_OF_SERVICE, TEMPORARILY_UNAVAILABLE) without registration location update. The method isProviderEnabledsimply indicates whether the provider is enabled at all or not (in the device settings), so it can return true, although the provider does not work ... Is there any other way for this?

Another question: is it possible to listen to status updates without registering for location updates? I want to listen to a specific provider for locations, but at the same time check if others are available. My current solution is to set the minimum time and distance to a very high value, but I wonder if there is a better solution ...

Thanks for any tips!

Btw: if possible, solutions should work with Android 1.1

+5
source share
1 answer

Why do you need GPS status if you are not interested in location?

However, you can get at least some aspects of GPS status:

final GpsStatus gs = this.locationManager.getGpsStatus(null);
int i = 0;
final Iterator<GpsSatellite> it = gs.getSatellites().iterator();
while( it.hasNext() ) {
    it.next();
    i += 1;
}
this.gpsSatsAvailable = i;

. http://developer.android.com/reference/android/location/GpsStatus.html 4 2D- 5 3D- ( ). fromStatusChanged(), . . , . , , GPS .

+2

All Articles