I’m currently working in an iOS app that other developer started. The app needs to monitor location changes because it needs to know the user position with low precision (hundred meters). The previous implementation of the location stuff was done using an NSTimer and startUpdatingLocation. The execution goes like this:
// Fire each 10 seconds start updating location
self.timerPosition = [NSTimer scheduledTimerWithTimeInterval:ti
target:self
selector:@selector(location)
userInfo:nil
repeats:YES];
[self.timerPosition fire];
Location selector does this
// Configure & check location services enabled
...
self.locman.delegate = self;
self.locman.desiredAccuracy = kCLLocationAccuracyHundredMeters;
[self.locman startUpdatingLocation];
And then in the location manager delegate
[manager stopUpdatingLocation];
But reading about getting the user location in Apple docs, it seems that the right way to get the location with low-power consumption is to use startMonitoringSignificantLocationChanges.
My question is, is a good decision to keep the location timer in combination with startMonitoringSignificantLocationChanges instead of startUpdatingLocation, or it’s a nonsense approach?
I do not need to get location when the app is in the background, but I want to know when the user has changed it’s position when the app is active.
I can tell you that the timer can’t and won’t be needed when you are using the low-power -startMonitoringSignificantLocationChanges. That method only responds to callbacks from the delegate when the device detects a change. This check for location is not using GPS, it uses Wifi and cell-tower triangulation which is already happening. So by using this method, there is no need to slow it down to save battery life. Just set up the delegate methods and respond accordingly.
I’m not sure what your implementation of location is for, but the region monitoring is also another great way to get location updates using little to no battery. Region monitoring is much more helpful when you have specific locations to monitor rather than just general user location. Hope this clears things up.