Skip to content Skip to sidebar Skip to footer

Check If Location Is Unavailable In Android Location Client

I would like to check if Location Client is able to provide any location. Is there any way to do so, apart from calling normal location system service?

Solution 1:

The accepted answer was correct at the time. But in recent times things have changed with the availability of the SettingsApi It allows you to check if the location services are available on the device and there is a complete example provided by google on github that shows how to use this API. The sample code will prompt the user to enable location if it's switched off.

Solution 2:

AFAIK, there is no method to check availability.

Possible Reason:

LocationClient uses fused API which gives location with appropriate combination of GPS,WiFi,Cell,Sensors (according to the Priority you have set for retrieving location).

Reference:

Fused API - Beyond the blue dot

Alternate Answer :

You already know it.you can check availability of provider by using location system service and LocationManager

Post a Comment for "Check If Location Is Unavailable In Android Location Client"