CLLocationManager not opening terminated app in background when user terminated app.

We have background location updates enabled in our app that updates the location on our servers to deliver realtime weather alerts. We see that we are receiving these location updates when the app is backgrounded by the user.

However, when the user removes our app from the background using the App Switcher, we no longer see notifications happening. We have the app delegate's "didFinishLaunchingWithOptions" method setup to check for .location in the launch options, and start location tracking immediately.

Is it the intention of the OS to no longer send our app background location updates if the user manually removes our app from the background?

It depends on which location API you are expecting to trigger a relaunch after removing the app from the App Switcher.

Most APIs will cause a relaunch. startUpdatingLocation() will not. All the other APIs will require "Always" location authorization at the time.

While the OS will still relaunch your app if using the appropriate APIs, you may not be able to see the .location launch option at all times. So, if you are solely depending on that option to determine if the background launch is happening, that could be what's throwing your logic off.


Argun Tekant /  DTS Engineer / Core Technologies

We are using the .startMonitoringSignificantLocationChanges() API, and kicking it off when the app moves to the background. We have confirmation that the "Always" loc authorization is set. And yes, we do use the .location launch option to restart tracking in the background.

As I understand background location tracking, it should work like this: 1: Start up loc tracking using the given API (in our case significant location changes to save battery). 2: OS sends to our app in the background location updates which we handle. 3: If the app is terminated, the OS will launch the app with launchOptions == .location, which we catch and restart background tracking as before.

I have not been able to confirm that 3 ever happens at all, if the app was terminated by the user. If we can't rely on the .location launch option, what is Apple's guidance for handling the above scenario?

CLLocationManager not opening terminated app in background when user terminated app.
 
 
Q