We have an app with carplay-messaging capability, and have successfully integrated our app in order to read out the list of unread messages.
However, if a single message arrives and our push notification appears, we are not able to have the Siri UI automatically read only that single message or announce it.
The 'list' UI appears (siri: "would you like to read your messages...") when tapping the notification, whereas we would like the 'item' UI to appear immediately with the "reply, repeat, don't reply" buttons.
Our intent handler service looks like this - basically the auto-generated one for a new Intent Handler Extension:
import Intents
// As an example, this class is set up to handle Message intents.
// You will want to replace this or add other intents as appropriate.
// The intents you wish to handle must be declared in the extension's Info.plist.
// You can test your example integration by saying things to Siri like:
// "Send a message using <myApp>"
// "<myApp> John saying hello"
// "Search for messages in <myApp>"
class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessagesIntentHandling, INSetMessageAttributeIntentHandling {
override func handler(for intent: INIntent) -> Any {
// This is the default implementation. If you want different objects to handle different intents,
// you can override this and return the handler you want for that particular intent.
return self
}
// MARK: - INSendMessageIntentHandling
// Implement resolution methods to provide additional information about your intent (optional).
func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INSendMessageRecipientResolutionResult]) -> Void) {
if let recipients = intent.recipients {
// If no recipients were provided we'll need to prompt for a value.
if recipients.count == 0 {
completion([INSendMessageRecipientResolutionResult.needsValue()])
return
}
var resolutionResults = [INSendMessageRecipientResolutionResult]()
for recipient in recipients {
let matchingContacts = [recipient] // Implement your contact matching logic here to create an array of matching contacts
switch matchingContacts.count {
case 2 ... Int.max:
// We need Siri's help to ask user to pick one from the matches.
resolutionResults += [INSendMessageRecipientResolutionResult.disambiguation(with: matchingContacts)]
case 1:
// We have exactly one matching contact
resolutionResults += [INSendMessageRecipientResolutionResult.success(with: recipient)]
case 0:
// We have no contacts matching the description provided
resolutionResults += [INSendMessageRecipientResolutionResult.unsupported()]
default:
break
}
}
completion(resolutionResults)
} else {
completion([INSendMessageRecipientResolutionResult.needsValue()])
}
}
func resolveContent(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) {
if let text = intent.content, !text.isEmpty {
completion(INStringResolutionResult.success(with: text))
} else {
completion(INStringResolutionResult.needsValue())
}
}
// Once resolution is completed, perform validation on the intent and provide confirmation (optional).
func confirm(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Verify user is authenticated and your app is ready to send a message.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .ready, userActivity: userActivity)
completion(response)
}
// Handle the completed intent (required).
func handle(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Implement your application logic to send a message here.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
// Implement handlers for each intent you wish to handle. As an example for messages, you may wish to also handle searchForMessages and setMessageAttributes.
// MARK: - INSearchForMessagesIntentHandling
func handle(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) {
// Implement your application logic to find a message that matches the information in the intent.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSearchForMessagesIntent.self))
let response = INSearchForMessagesIntentResponse(code: .success, userActivity: userActivity)
// Initialize with found message's attributes
response.messages = [INMessage(
identifier: "identifier",
conversationIdentifier: "convo1",
content: "I am so excited about SiriKit!",
dateSent: Date(),
sender: INPerson(personHandle: INPersonHandle(value: "sarah@example.com", type: .emailAddress), nameComponents: nil, displayName: "Sarah", image: nil, contactIdentifier: nil, customIdentifier: nil),
recipients: [INPerson(personHandle: INPersonHandle(value: "+1-415-555-5555", type: .phoneNumber), nameComponents: nil, displayName: "John", image: nil, contactIdentifier: nil, customIdentifier: nil)],
messageType: .text
)]
completion(response)
}
// MARK: - INSetMessageAttributeIntentHandling
func handle(intent: INSetMessageAttributeIntent, completion: @escaping (INSetMessageAttributeIntentResponse) -> Void) {
// Implement your application logic to set the message attribute here.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSetMessageAttributeIntent.self))
let response = INSetMessageAttributeIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
}
Is there specific configuration required to allow display of a single message via tapping on the notification?
Posts under CarPlay tag
160 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have had the sage issue with ever beta since ios16.
Resetting my cars infotainment system seems to fix it.
Unsure about other cars, but if I reset my Mazda system by holding the music button, nav, and volume button (mute), for 15-20 seconds, it works again after the recor reboot
My car was working perfectly fine but I updated to 18 beta since then Google maps keeps going blank and i have to keep Google map on on my mobile screen if i need to use on car play and also not able to click on any thing on car play’s screen
i init a CPAlertTemplate with a CPAlertAction, on iOS17, action can called by button click, but on iOS18, action can not be called by button click.
so i can't dissmiss the alert by button click.
CarPlay touch screen not responsive on some Apps Especially TomTom Google maps Music app and others. not sure what’s gone wrong but needs Sorted and quick
We are currently looking into enabling CarPlay for a navigation app. The navigation app allows complex trip planning (not focussed on A-B planning like Apple Maps).
As we found the guidelines somewhat loose in this area, we are wondering, if it is allowed to have a navigation app that only offers the navigation feature, so no planning?
Any route planning actions needs to be done on the iOS device. So, if you haven't planned/loaded a route, you would only see your location on a map and can drive freely, but without guidance.
The Car App programming guideline mentions the select destination as explicit flow of a navigation app. Which makes us think that it might be required to support that flow.
Using either of these with CarPlay now the phone must remain open and unlocked and the maps must be active. Of the maps app for either of these apps gets closed, on Google Maps the map freezes and will not do anything. I also am unable to keep my phone open and unlocked using Google maps.
on Waze the maps screen just turns off if the phone is locked or the Waze app isn’t open and active. Additionally when starting Waze on the split screen where it shows music, maps, and the next turn on CarPlay, the next turn screen appears as if the Waze app is just open but not headed in a specific direction So it just says search. You have to open to the full screen Waze app on the car play screen then back to the split screen for it to work.
Google maps is effectively broken while Waze can be used with a work around. Though Waze also randomly stops the directions and goes back to just showing the maps and you have to get directions again to restart it telling you the turn by turn. Screen on phone and CarPlay just goes into the mode as if you just started Waze with no destination.
I tested the official demo, it will be the same, is there a problem with CarPlay release?
This is the code for creating a list of 50 elements
var listItems = [CPListItem]()
for _ in 0..<50 {
autoreleasepool {
var item: CPListItem
item = CPListItem(text: "标题", detailText: "标题22222", image: UIImage(named: "local_album_no"))
listItems.append(item)
}
}
let listTemplate = CPListTemplate(title: "最近播放", sections: [])
let section = CPListSection(items: listItems)
listTemplate.updateSections([section])
self.carplayInterfaceController?.pushTemplate(
listTemplate, animated: true, completion: nil)
When I exit the page, but the page does not free, causing memory to keep increasing.
I have also tested the official demo, and there are problems that will not be released.
Can you check if this is a bug in the system.
What can I do to avoid this problem?
This is the CarPlay page, and the phone is running iOS17.5
The template creation code is as follows:
CPListTemplate *listTemplate = [[CPListTemplate alloc] initWithTitle:@"最近播放" sections:sections];
listTemplate.delegate = self;
[_interfaceController pushTemplate:listTemplate animated:YES completion:^(BOOL success, NSError * _Nullable error) {
}];
sections have many CPListItem.
When I exit the page, but the page does not free, causing memory to keep increasing.
I tried to refresh empty sections after exiting the page and memory freed for me, which confused me.
Do we have to manage the memory ourselves?
My code is as follows
[_interfaceController pushTemplate:template animated:YES completion:^(BOOL success, NSError * _Nullable error) {
}];
push a template, and the memory will increase accordingly, but after clicking exit, the memory will not drop down, resulting in continuous accumulation
And my page is a list, each item contains an image, memory is growing very fast
Does template need to manage memory by itself?
My Iphone is connected to the car via wireless carplay. Technically, the onboarding works via bluetooth, then via the car's hotspot (SSID from the car).
I have noticed that an SSID appears under the "known networks" that has no name.
The SSID can no longer be deleted, not even with a network reset on the Iphone. I asked my car dealer if he could reproduce the problem with his Iphone and another car. And he can! So it's not my device, it's an Apple problem. To be precise: The fact that you can no longer delete the SSID is Apple's problem, why the car stores an SSID without a name on the Iphone when connecting is possibly the problem of the car manufacturer. Here are a few more screens on this case.
Hi,
we are developing a carpooling app. In our app, once, the car driver enters his car, the app connects automatically in the background to the car. The connection to the car is done either via CarPlay or Bluetooth. Currently, when setting up the app, the user has to define how the connection to the car is established. He can choose between three options: either 1)CarPlay, or 2)Bluetooth or 3)both.
Is it correct, that starting with the AccessoyKit of IOS18, the user will only have to choose the device, he wants the app to be connected with? However, he no longer has to define the kind of connection, i. e. CarPlay or Bluetooth by which to connect to the device?
So in future, users will be able to connect to their Car, but they do not even know, whether the connection is via Bluetooth or CarPlay?
If that is the case, it would make our lives much easier;)
Many thanks for your help!
Greets, Simon
Is there a reason why the active mute indicator is different between CarPlay and iPhone? The iPhone active mute indicator is a button with a white background and a red icon whereas the CarPlay active mute indicator is a button with a white background and black icon.
We make a CallKit app that supports CarPlay and that's how this was noticed, however the Apple phone app behaves the same. I suspect this is intentional as to cut down on distractions for drivers.
Any further explanation would be appreciated.
Thanks
I’ve been using iOS beta 3 for a few days, and I’ve began to notice that I am not able to send messages through CarPlay. At first, I thought it was a bug with my phone, so I restarted it. Then, I removed my car from CarPlay and reconnected, then connected it to a family members car and still have the same issues.
The issue being whenever I try to send a message using Siri, she replies with “There is not an app for that, download one when not in the car.” Or something along those lines. If anyone else is having the same issue, or knows a fix, please let me know.
I have the CarPlay Entitlement "Driving Task" and two of my apps use it.
Now, in both apps, I have implemented Navigation. I requested the Navigation CarPlay Entitlement when the feature was mature and builds were available in Test Flight, since I wanted to release the new versions of the apps with navigation available both on the iPhone and in CarPlay.
I got no answer to my request, so I decided to release the apps with only navigation in the iPhone and the Driving Task functionality in CarPlay, thinking that maybe being live with navigation in the App Store was a requirement. I have asked permission again, and so far, the request is being ignored again.
What are the requirements to get the Navigation CarPlay Entitlement?
If the app is approved for navigation, is there something else the app must do to get the entitlement?
Requirements for CarPlay Entitlements seem quite obscure, are they listed anywhere?
Is there a technical problem to move from an existing CarPlay Entitlement to another? Can that be the reason the entitlement has not been granted?
Some of my competitors have the CarPlay Navigation entitlement. My use case is the same (in a better app in my opinion, of course). But I am only getting bad reviews because "the app does not include the map in CarPlay" after the big investment in implementing navigation in the apps.
Any help or insight would be appreciated.
Greetings,
I am currently conceptualizing an application designed to interface with Carplay, enabling control over aftermarket automotive fragrance systems and ambient lighting within vehicles. Having perused your development guidelines, I am interested in understanding how my project might be classified within your framework. Specifically, I am exploring whether it would be appropriate to categorize this endeavor under the 'Driving Task' category, given its direct interaction with the vehicle environment.
Your insights on this matter would be greatly appreciated.
Best regards!
I am working on a communications CarPlay app and am implementating a calling tab. I want to display calls that are missed in red text vs answered in the default text color. Is there a way to change the color of CPListItem.text or is this not allowed by design?
Hi,
I'm trying to investigate if there is any way to have an app that displays an automaker app when the Carplay environment has the automaker protocol string, and displays a Carplay App (Driving Task) when there isn't the automaker protocol string.
I was able to start developing an automaker app, but with an iOS16.0 deprecated method (with UIScreen Notifications), I'm not able to do it via the scene delegate... There is any kind of documentation of how to do it?
I think the clue may be in the scene delegate with the property Preferred Default Scene Session Role, where I think the automaker app is a Window Application Session Role, but the scene delegate is not triggered when I open the Carplay App in the simulator.
So am I missing something? Is there a way to do it or have I to publish two apps in order to use the two kind of carplay apps... ?
Thank you very much.
[posted January 30, 2024]
Earlier this month, Apple Classical appeared as an app in CarPlay. Hallelujah!!! Three days later it disappeared after another update, apparently because all it did when activated via CarPlay was crash. OK, it was an oopsie (I get it. I spent 30 years in IT, and, well, it happens. They’re called “undocumented features”). Thing is: Apple hasn’t breathed a word about this event at all. Nothing. Nada. Zip. Zippo. Zilch. There’s a huge pent-up audience for this app in CarPlay. Is it coming? Please? Oh please oh please oh please?
Touchscreen gestures in CarPlay aren't recognized in the app (delegate CPMapTemplateDelegate functions aren't called). Tried also in the Coastal Roads demo app to add test functions to check that pan functions are called - the same:
func mapTemplateDidBeginPanGesture(_ mapTemplate: CPMapTemplate) {
MemoryLogger.shared.appendEvent("Did begin pan gesture.")
}
func mapTemplate(_ mapTemplate: CPMapTemplate, panBeganWith direction: CPMapTemplate.PanDirection) {
MemoryLogger.shared.appendEvent("Did begin pan gesture with direction \(direction.rawValue).")
}
Note: buttons (on carplay app) are working when pressing on them. Also, the desktop of carplay can be panned (by swipe gesture).
Using Xcode 14.3, MacBook pro M1