I am working on Audio CarPlay app. Recently I came up with scenario when I connected to the CarPlay and I kill app from mobile device still I can see app active on CarPlay unit. So it there any way to close app from CarPlay unit when user kill app from background in mobile device. Spotify is closing app from CarPlay unit when killing app from mobile device.
Asked
Active
Viewed 322 times
1 Answers
0
When I create a test CarPlay application and run it on simulator, its CarPlay scene is closed automatically after closing the main scene on the phone. Therefore I'm not sure if the suggestion works.
Anyway, the suggestion is:
- listen to
SceneDelegate.sceneDidDisconnect
orAppDelegate.application(_:didDiscardSceneSessions:)
- send custom notification with NotificationCenter to let CarPlay scene know that the main scene is closed
- request closing CarPlay scene using
UIApplication.requestSceneSessionDestruction

alexander.cpp
- 747
- 6
- 15
-
thanks for the answer. For CarPlay I am not following Scene based approach for CarPlay implementation instead using MPPlayableContentManager for rendering content on Car. I am executing CarPlay code on each app launch. Do I still need to close CarPlay scene when main scene is closed? – Vandan P Aug 30 '21 at 10:02