I'm working with CLLocationManager
class. I want to get location updates periodically. I had found two methods to get location in didUpdateLocations
method, that are startUpdatingLocation()
and startMonitoringSignificantLocationChanges()
. If I have to track location updates in foreground mode also then which method should I use?
The most important difference between the 2 is this:
startMonitoringSignificantLocationChanges: it does not rely on the value in the distanceFilter property to generate events. The receiver generates update events only when a significant change in the user’s location is detected
startUpdatingLocation : the receiver generates update events primarily when the value in the distanceFilter property is exceeded
So, if you want more precision, go for startUpdatingLocation
, at the expense of more battery consumption, but more precision of the location. It really depends on your goal, you should evaluate the tradeoff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With