Post

Replies

Boosts

Views

Activity

How to Get the Selected Tab in CPTabBarTemplate When Clicking a Tab in CarPlay?
Hi everyone, I'm developing a CarPlay application and using a CPTabBarTemplate to display multiple tabs. I want to determine which tab is selected when the user clicks on a tab, specifically when switching to the second tab. Here’s the relevant part of my code: class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate { var interfaceController: CPInterfaceController? var tabBarTemplate: CPTabBarTemplate = CPTabBarTemplate(templates: []) func templateApplicationScene( _ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController ) { self.interfaceController = interfaceController // Create and set the TabBarTemplate let tabBarTemplate = createTabBarTemplate() self.tabBarTemplate = tabBarTemplate interfaceController.setRootTemplate(tabBarTemplate, animated: false) { success, error in if let error = error { print("Error setting TabBarTemplate: \(error.localizedDescription)") } else { print("TabBarTemplate set successfully.") } } } func createTabBarTemplate() -> CPTabBarTemplate { let listItem1 = CPListItem(text: "Item 1", detailText: "Detail 1") let listItem2 = CPListItem(text: "Item 2", detailText: "Detail 2") let listTemplate = CPListTemplate( title: "List", sections: [CPListSection(items: [listItem1, listItem2])] ) let gridButton1 = CPGridButton( titleVariants: ["Grid 1"], image: UIImage(systemName: "star.fill")! ) let gridButton2 = CPGridButton( titleVariants: ["Grid 2"], image: UIImage(systemName: "star")! ) let gridTemplate = CPGridTemplate( title: "Grid", gridButtons: [gridButton1, gridButton2] ) return CPTabBarTemplate(templates: [listTemplate, gridTemplate]) } }
1
0
131
1w
Is it possible for CarPlay to establish a connection with a Bluetooth Low Energy (BLE) dongle when the phone app is fully closed or not running in the background?
I’m currently developing an app that communicates with a BLE dongle. When I swipe up to close the app on my phone, both the phone app and the CarPlay app are terminated. From the CarPlay interface, I can relaunch the app. My question is: Can CarPlay establish a connection with a BLE dongle when the phone app is fully closed or not running in the background?
3
1
348
Oct ’24
Can from carplay when user tap an app and open the app as noralmy like Spotify
Currently, when on the phone, like Spotify, I fully close the Spotify app, and in Carplay, when the user clicks on the Spotify app, this app can open as normal. I also developed my app but when I open the app in carplay, it shows a white screen, and then the app auto-terminates (closes permanently). How Can I do the behavior like the Spotify app, My app also enabled background mode in xCode. Please help me. Thanks so much
1
0
212
Sep ’24