Search code examples
iosswiftbackgroundlocation-updates

How long does "location updates" process can run in background?


Assumes that I registered "location updates" service. If the location changes significantly, the callback function gets invoked.

Question: How long is my function allowed to run in the background? Let's say the function does so much work and need 10 minutes to finish, will it be terminated by system? enter image description here I guess Apple won't allow long-run job in location-updates-callback. But I couldn't find the official explanation. Could anyone help? thanks a lot.

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html


Solution

  • Your app will receive location updates till it stays in background. There's a chance that your app would go inactive when other active apps require memory. In this case, your app will stop receiving location updates. There's no fixed background execution time mentioned anywhere in Apple's documentation. It may be possible that your app can receive location updates for more than 10 minutes but only if it stays in background.