I have written the below code for getting the best provider available.
private static String provider;
public static String setCriteria(LocationManager locationManager) {
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
provider = locationManager.getBestProvider(criteria, true);
LocationProvider locProvide = locationManager.getProvider(provider);
if (provider == null) {
provider = LocationManager.GPS_PROVIDER;
}
return provider;
}
I am having this code to find the Provider which i will be using to get the Location. Now what i wish to check is that the status of the Provider. I read from doc that LocationProvider has 3states Available, Out of service & TEMPORARILY_UNAVAILABLE. Now i before requesting to location listener i need to check the status.
If the status is for e.g TEMPORARILY_UNAVAILABLE or Out of Service then user will get the message accordingly else it will find the location. So my question how can i check the status?
If anyone has any idea please kindly help me...