According to WWDC sessions, the recommended approach for continuing location collection in the background with liveUpdate is by using CLBackgroundActivitySession.
In the app I’m currently developing, I call the invalidate function on the backgroundActivitySession instance when the app enters a terminated state. Then, when the app is resurrected due to startMonitoringSignificantLocationChanges, it reinitializes liveUpdate to resume location collection. When initializing CLBackgroundActivitySession, I also reinitialize the liveUpdates object to ensure the CLLocation.Updates instance is refreshed.
However, regardless of the order in which I refresh these two instances, location collection does not resume when the app is revived in the background. Should the originally created CLBackgroundActivitySession instance never be invalidated?
Any guidance on whether I am implementing this correctly would be greatly appreciated.
A new CLBackgroundActivitySession can only be started from Foreground. From background only an existing running CLBAS session can be continued.
So when your app is resurrected in the background and a new CLBAS + liveUpdates is created (refresh) , CLBAS will have no affect because the one started from Foreground is already invalidated. Hence app can't get any background location powers.
Invalidate the session if the app does not has any interest in Background Location Updates and expects to start the user-flow again from the Foreground.
So in this case it does seems like CLBAs should be kept running and not invalidated.