I'm currently working on an app that uses CLLocationManager with the lowest accuracy (kCLLocationAccuracyThreeKilometers). However, once every couple minutes I need to get an accurate location of the user, so I set the accuracy to kCLLocationAccuracyBest when a timer expires.
Obviously, CLLocationManager starts updating the location, going from an inaccurate location to more accurate locations in steps. The problem is, however, that I don't know how to detect when the optimal location accuracy has been reached, so I never know when I have the best location to work with.
Does anybody know a solution to this problem? It would be highly appreciated.
IN the CLLocationManagerDelegate
method locationManager:didUpdateLocations:
look at the horizontalAccuracy
of CLLocation
. This will give you the radius in meters.
As stated in documentation:
The radius of uncertainty for the location, measured in meters. (read-only)
The location manager will keep trying in getting the best accuracy as possible, so you will have to decide when the location is accurate enough.