GetLastKnownLocation() Returns Null Even With Best Provider
This is the Code I use to get the current location: mgr = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); best = mgr.getBestProvider(crite
Solution 1:
getLastKnownLocation()
only returns a Location object for a provider if that provider has been used recently. If it has not been recently, Android assumes that whatever was the last location given by that provider is out of date and wrong, and returns null.
In such a case, you will have to wait for your LocationListener's onLocationChanged()
method to be called before you have a usable location.
Post a Comment for "GetLastKnownLocation() Returns Null Even With Best Provider"