CLLocationManager startUpdatingLocation vs startMonitoringSignificantLocationChanges

I am working on a web application that allows users to enter the application only if they are in certain regions. I called locationManager startUpdatingLocation at the beginning of my application to get the user's location and enable / disable login.

As soon as the user logged in, I called

 [locationManager stopUpdatingLocation]; [locationManager startMonitoringSignificantLocationChanges]; 

and registers the user when the updated location is outside the region. Will using the two methods be a collision anyway? (I am testing the code on a simulator, so the location is always the same).

Note. I do not use didEnterRegion or didExitRegion , because everything is processed using existing Javascript code. I send only the current location of the user.

+6
source share
1 answer

It really depends on what you need with the location after the user logs in. When you track significant changes, your locationManager will only be notified of major changes. (e.g. new cell tower, Wi-Fi change, different application location, etc.). It will not be permanent. If all you care about is logging in, I might end up with significant monitoring. If you still need a place, then be prepared only to receive periodic updates in this place.

+2
source

Source: https://habr.com/ru/post/897258/


All Articles