I have a VoIP app. It used to work without CallKit, so it has its own in-app call UI. I'm now integrating CallKit UI to handle calls which happen when the app is not running, and have a question:
What is the recommended way to detect a moment when the CallKit UI is dismissed and is going to switch to the in-app UI?
Currently I see that the CallKit UI disappears in 2 cases:
- when the app process is not running, and the device is unlocked (e.g. on the home screen) and the call arrives, the CallKit UI appears at first, but if you accept the call (answer), then the CallKit UI disappears immediately, and the app appears.
- when the app process is not running, and the device is locked, the call arrives, the CallKit UI appears, you accept the call (answer), and then press the app icon in the CallKit UI, then again the CallKit UI disappears, and the app appears.
What is the recommended way to detect these conditions in order to spawn the in-app UI?
The reason why I don't want to have the in-app UI started all the time is performance and logic. I think it would be wasteful to show and update the controls and video views (the app has video support) while the CallKit UI is on top of the screen. It would be more logical to me if I could detect that the UI switch is needed, and create a UI at that point.
I have looked over the CallKit API, but found nothing for that purpose.