SMKS
SMKS

Reputation: 1061

iOS Location - Significant Location Change in iOS 8/9 can start standard location service?

Many questions concerning iOS Location tracking have been asked on here, but recently Apple has updated much of their functionality and so many of the answers are obsolete, my question is specifically targeting iOS 8 and 9.

I am interested in creating a location tracking application which will accurately track the user even when the app is closed. To do this, apple states:

If you leave the significant-change location service running and your iOS app is subsequently suspended or terminated, the service automatically wakes up your app when new location data arrives. At wake-up time, the app is put into the background and you are given a small amount of time (around 10 seconds) to manually restart location services and process the location data.

So my understanding is, if you have all of the necesarry permission and plist keys present, the OS will wake up your app and allow you to do something for 10 seconds, or if it needs more time it can:

If an iOS app needs more time to process the location data, it can request more background execution time using the beginBackgroundTaskWithName:expirationHandler: method of the UIApplication class.

Now, this says that if my app needs more time to process the location data, it may start a background task (with an expirationHandler) to handle that. When reading about background tasks, I read that background tasks can run for a maximum of 10 minutes

So my overall question is, when my app gets woken up when a significant location change has occurred, is it possible to start the standard location service and have it run in the background indefinitely? Is it possible to start another background task before the first one expires?

EDIT: From the Apple Documentation it says:

because it wakes the system and your app at least every 15 minutes, even if no location changes have occurred, and it runs continuously until you stop it

So my idea is, if the user starts their phone from nothing and never opens the app, after at most 15 minutes (even if they are standing still), the OS will fire my app, in which case I could start a background process that I can start the GPS tracking in, and thus getting accurate GPS location. Would this logic work with the OS?

Upvotes: 0

Views: 2464

Answers (1)

AlexWien
AlexWien

Reputation: 28727

The main problem is that significant location changes cannot be used for "accurately track" the user.
Significant means 1000m, since it is cell tower based, and not GPS based. So your app is woke up when the user moves into the next GSM cell.
This is not acurate enough for acurate tracking.

finally this means you cannot acuratley track when the app is closed, this works only in running app or background running up.

"When reading about background tasks, I read that background tasks can run for a maximum of 10 minutes"

No, thats not true. My app runs in background and records GPS locations until the battery is drained (8h+). (It does not use the significant location mode)

Upvotes: 3

Related Questions