0

My app uses UNMutableNotificationContent() to play a custom sound, and has a phrase as a message. I just got a vehicle with CarPlay. When my iPhone is connected to CarPlay, when the notification goes off at the time I have it set, it shows on the iPhone, but does not make any noise whatsoever.

What I'd like to happen, is for CarPlay to receive the notification and play the sound, or announce the message when the notification goes off, like it does with Apple's messages app. As my phone is set right now, when I have my airPods in, it will announce the notification from my app. But not for CarPlay.

What do I need to add to my app to allow CarPlay to handle the message that comes in from a notification (again, local, not a push notification).

After reading a bunch of posts on here and Apple Developer, I added this to my teat app on this.

let category = UNNotificationCategory(identifier: "CarPlay", actions: [], intentIdentifiers: [], options: [.allowInCarPlay])
UNUserNotificationCenter.current().setNotificationCategories([category])

and

content.categoryIdentifier = "CarPlay"

to the notification. It still doesn't do anything different. Nothing on CarPlay at all.

ShadowDES
  • 783
  • 9
  • 20

1 Answers1

0

For safety reasons, notifications are not generally announced or displayed when your phone is connected to CarPlay. This is to reduce driver distractions

The allowInCarPlay category option only has an effect when your app is approved for CarPlay and has a CarPlay entitlement from Apple.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • My plan is to get CarPlay entitlement for this app if what I want to happen can be done.. I sort of need to know how it is done to know exactly what to ask for. Is this a CarPlay.communications type? I've been working with a test app in the simulator with CarPlay entitlements, but can't seem to get it to work. – ShadowDES Aug 23 '23 at 04:25
  • You will need a CarPlay entitlement before you can even test CarPlay functionality. The functionality required for a CarPlay communications app are listed [in the CarPlay app programming guide](https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf#page6). As you say that the content is from a local notification, the it seems likely that your app is not a communication app. – Paulw11 Aug 23 '23 at 12:02