We are in the process of migrating our application to SceneDelegate. We currently check in a variety of places if the app is running in the background for analytics reasons. The app may be running in the background due to location updates, notifications being received, or background refresh. With scene delegate, the app starts in the background state and only becomes active once a scene has connected. We have been unable to find a way if an app is truly running in the background or if a scene delegate is about to be launched.
Scene Delegate Migration Lifecycle
@YinzCam_Inc Before actually creating your scene object, UIKit calls the application(_:configurationForConnecting:options:)
Upon entering the background, UIKit calls one of the following methods of your app:
-
The sceneDidEnterBackground(_:) method of the appropriate scene delegate object.
-
applicationDidEnterBackground(_:) method of the app delegate object.
To learn more about state transitions for scenes you should review Managing your app’s life cycle article.
Preparing your UI to run in the foreground to learn more about how to update your app’s data model when entering the foreground and Preparing your UI to run in the background
@DTS Engineer this doesn't really help us know if the app is launching into the background though