17

What happens if I call startUpdatingLocation while startMonitoringSignificantLocationChanges is running? Does significantLocationChange monitoring get stopped? If I then stopUpdatingLocation will significantLocationChange monitoring continue or restart?

I can find no documentation covering the interplay between these two ways of monitoring location.

Undistraction
  • 42,754
  • 56
  • 195
  • 331
  • Hey, did you find any more information regarding this ? Especially the interaction part. Does iOS stop one from running if the other one is started ? – Philiiiiiipp Jun 06 '14 at 13:26
  • Do you know if you can do `startUpdatingLocation` after you get a `startMonitoringSignificantLocationChanges` in the backgroundState? – mfaani Aug 09 '17 at 16:28
  • I'm sorry but I haven't used this API for many years. Why don't you ask a new question? – Undistraction Aug 11 '17 at 14:10

3 Answers3

27

I don't think the accepted answer really answers the question asked. I did some tests and you can use both if you want and they will not cancel each other out.

Why would someone want to use both ? Because startMonitoringSignificantLocationChanges wakes up the app from being suspended or terminated without the need of any background modes. So if you run both you can get accurate foreground location updates and significant location change background location updates.

Of course, you can switch the method, when going into background but a) that wasn't the question b) it adds unneeded logic

Of course, there's a question if running both methods drains more battery, but my bet is that it doesn't.

michal.ciurus
  • 3,616
  • 17
  • 32
5

They are not meant to be used concurrently. It's either or as they both deliver heading and location changes to the same delegate method.

locationManager:didUpdateToLocation:fromLocation

They differ in the frequency and accuracy (and by extension hardware used and power consumption ) of the changes. You as the developer need to decide which is best based on your use case

I have a need to use both approaches at different times. When I switch from one to the other I set a flag that I can reference in my delegate so that I know the type of update.

Coder Head
  • 76
  • 3
  • 1
    Thanks. This is exactly what I'm doing at the moment. I've wrapped the CLLocationService with my own service and I'm using that to set flags for the type of services being used. I was just interested in how the two interact. It's interesting how completely the Apple docs neglect to mention this subject. – Undistraction Jun 26 '12 at 16:54
  • 2
    In the latest docs, Apple does mention that they can be run simulaneously, but does not provide any detail on interaction. "If both location services are enabled simultaneously, they deliver events using the same set of delegate methods." https://developer.apple.com/reference/corelocation/cllocationmanager – Cesar Maiorino Oct 06 '16 at 16:38
4

Standard location service and significant location change service can be used together. Quote from the API Reference:

If both location services are enabled simultaneously, they deliver events using the same set of delegate methods.

A good reason to use both is that the standard service gives better accuracy, while the significant location change service works even when your app is suspended.