We have a setup that's really close to the one used in the example project - Monitoring location changes with Core Location.
In short, we have a flag that indicates whether or not we should start background location monitoring. If the flag is on, after the app starts, we
- Create a
CLServiceSession
withauthorization: .always
- Create a
CLBackgroundActivitySession
The user can perform an action (press a button) to toggle the flag off, in which case we invalidate and dispose of the CLServiceSession
and CLBackgroundActivitySession
instances and cancel any liveUpdates
observation.
So far, so good, everything works as expected.
However, we're experiencing a weird behavior on iPhones with Dynamic Island after there's an app update.
When the user is on the same app version, the behavior is correct.
- have the flag on,
- background location monitoring works fine,
- when the app is in the the background, there's correctly a location indicator in Dynamic Island
- the user can go back to the app and turn the flag off (disposing of instances, cancelling location observation), and when the app is in the background, there is no location indicator in Dynamic Island
The problem arises when the user updates the app
- open version 1.0 of the app
- have the flag on,
- background location monitoring works fine,
- when the app is in the the background, there's correctly a location indicator in Dynamic Island
- download an app update - version 2.0
- the app restarts,
didFinishLaunchingWithOptions
gets called again and we start the background services - dynamic island indicator is correctly showing a location indicator
- the user goes into the app, toggles the flag off - turning location observation off, we dispose of everything
- now, when the app is moved to the background, there's still a location indicator in the Dynamic Island, even though we're no longer observing location
The indicator is hard to get rid of, there are only 2 ways we've found
- restart the device, or
- uninstall the app
The question is - is this a bug in the system? Or is there anything we should be doing actively after an app update?
Thank you!