Notifications provide drivers with short, timely information about events from
your app while it's not in use. Notifications can appear in the
Notification Center, and some notifications can also appear as
heads-up notifications on the display. To create notifications for
Android Automotive OS, you use the same
NotificationBuilder
API
that you use for other devices. However, to ensure the safety of drivers and
minimize distraction, some API methods and classes are
restricted or behave differently.
How notifications differ in cars
To create a safe driving environment that is free from distractions, notifications on Android Automotive OS differ from notifications on other devices in the following ways:
- Simplified user interaction
- UX restrictions based on drive state
Simplified user interaction
To ensure that drivers can focus on the road, notifications in the car have a simplified user interaction model with the following features:
No complex controls
Notifications do not allow complex controls, such as tapping to expand a notification, long pressing a notification for additional options, or using controls based on swipe-length gestures.
Notification sounds
Notifications only play a sound if they trigger a heads-up notification.
Automatic play and mute buttons for messaging notifications
Android Automotive OS automatically adds Play and Mute buttons to all car-compatible messaging notifications.
- Play: Reads the notification to the driver using the user's default digital assistant (such as the Google Assistant) or the vehicle's default text-to-speech system.
Mute: Prevents heads-up notifications from appearing for any future messages in the conversation for the remainder of the drive. Message notifications from a muted conversation still appear in the Notification Center, and the driver can also unmute the conversation from the Notification Center.
Simplified notification display options
RemoteViews
and custom content views are not supported. In addition, the following
notification styles are not supported:
BigPictureStyle
BigTextStyle
InboxStyle
If your app sends a notification to Android Automotive OS using one of these notification styles, only summary text is shown.
Simplified notification channel management
Android Automotive OS does not support notification channels and related UI affordances in order to decrease the prevalence of rich management tasks in Automotive devices.
UX restrictions based on drive state
Android Automotive OS includes a UX Restrictions Engine. Car manufacturers can use this engine to restrict notifications based on the car's drive state in the following ways:
- Truncating notification strings at a specific character length
- Hiding message summaries for
CATEGORY_MESSAGE
notifications - Limiting the number of notifications that the Notification Center can display
Supported resource types
By default, Android Automotive OS supports a limited subset of the resource types that can be used for notifications on other devices. This subset includes the following resource types:
- Drawables
- Icons
- Images
Compatibility requirements for messaging notifications
To provide a consistent and minimally distracting user experience, messaging notifications have special requirements on Android Automotive OS.
A messaging notification is car-compatible if it fulfills the following requirements:
- Belongs to the
CATEGORY_MESSAGE
category. - Uses the
Notification.MessagingStyle
style. - Should include only unread messages.
Has a mark-as-read
Action
that fulfills the following requirements:- The semantic action must be set to
Action.SEMANTIC_ACTION_MARK_AS_READ
. - The
Action
must indicate that it will not show any user interface when fired.
- The semantic action must be set to
If the notification has a reply
Action
, then theAction
fulfills the following requirements:- The semantic action must be set to
Action.SEMANTIC_ACTION_REPLY
. - The
Action
must indicate that it will not show any user interface when fired. - The
Action
must contain a singleRemoteInput
.
- The semantic action must be set to
Notification Center
Almost all notifications appear in the Notification Center, even if those notifications were also triggered as heads-up notifications. Notifications persist in the Notification Center for the duration of a drive.
Drivers can interact with notifications in the Notification Center. Depending on the car's manufacturer, drivers access the Notification Center in one or both of the following ways:
- Swiping down from the top of the screen (similar to the notification drawer on other devices)
- Tapping a button in the system interface
Grouped notifications
Related notifications
are automatically grouped together in the Notification Center,
like in the notification drawer on other devices. However, when a
driver taps the summary for a group in the Notification Center, instead of
launching a
PendingIntent
,
the group expands to show all of its notifications.
Notifications that do not appear in the Notification Center
The following notifications do not appear in the Notification Center:
- Media playback notifications for
CATEGORY_TRANSPORT
. Information about ongoing media playback is gathered by Android Automotive OS and displayed in a dedicated place in the user interface. - Turn-by-turn navigation notifications for
CATEGORY_NAVIGATION
. - Foreground service notifications for system privileged apps and apps that
are signed with the platform key that have an importance level lower than
IMPORTANCE_DEFAULT
.
Heads-up notifications
Heads-up notifications appear as a notification card on top of the screen. Because a heads-up notification draws the driver's attention, apps should only trigger a heads-up notification when the information is drive-critical, time-sensitive, and actionable. Only certain categories of notifications can trigger a heads-up notification.
Car manufacturers can decide whether or not to allow heads-up notifications to appear while the Notification Center is open.
How apps trigger heads-up notifications
Apps have different requirements for triggering a heads-up notification, depending on whether they have system privileges or not.
- For system-privileged apps and apps that are signed with the platform key
- The app can trigger a heads-up notification by setting the notification
channel importance to
IMPORTANCE_HIGH
or higher. - For all other apps
To trigger a heads-up notification, the app sets the notification channel importance to
IMPORTANCE_HIGH
or higher and ensures that the notification belongs to one of the following categories:
Life of a heads-up notification
After an app triggers a heads-up notification, the notification appears immediately on the car's screen. If the driver takes no action, the heads-up notification is dismissed automatically after 8 seconds (configurable by car manufacturers), except in the following cases:
Heads-up notifications for certain incoming calls cannot be dismissed, and the heads-up notification remains until either the driver accepts the call, or the call is terminated. To qualify as an undismissable heads-up notification for an incoming call, a notification must fulfill the following requirements:
- Belong to
CATEGORY_CALL
- Set a fullscreen intent
- Be marked as ongoing using the
setOngoing()
method
- Belong to
Heads-up notifications remain if an app updates the notification within the 8-second time window.
When a heads-up notifications is dismissed, the notification is listed in the
Notification Center unless it is a
CATEGORY_NAVIGATION
notification.
Notification API changes and restrictions for cars
This section summarizes the differences for each class where the Notifications API behaves differently or has restrictions for Android Automotive OS.
Notification.Builder
The following tables describe the API changes and restrictions in the
Notification.Builder
class.
Table 1. Changes to public methods for Notification.Builder
Public methods | Effect | Description |
---|---|---|
|
Conditional no-op | Notification.MessagingStyle notifications must add the
actions specified in the
compatibility requirements. Any
additional actions that are added will not be rendered as Notification
buttons. |
|
No-op | RemoteViews
and custom content views are not supported. |
|
No-op | Notification badges are not supported. |
| No-op | Countdown timers are not supported. |
setColorized() |
Constraints changed |
Platform-signed apps: Configurable; allowed by default. System-privileged apps: Configured by platform; disallowed by default. All other apps: Configured by platform; disallowed by default. |
setFullScreenIntent() |
Behavior changed | Does not auto-launch the intent. |
setLargeIcon() |
Behavior changed | Large icons are shown on the right-hand side of the notification. |
setLights() |
No-op | Android Automotive OS devices do not have LED indicator lights. |
setOngoing() |
Behavior changed |
Behavior is different when the notification is also triggering a heads-up notification. Only makes the heads-up notification undismissable if the heads-up notification is for an incoming call. To qualify as an undismissable heads-up notification for an incoming call, a notification must fulfill the following requirements:
Drivers can dismiss all other types of heads-up notifications. |
|
No-op | Private mode is not supported. |
setSettingsText() |
No-op | Notifications do not support affordances that link to app settings. Drivers access app settings through the app instead. |
setTicker() |
No-op | Ticker text is not supported. |
Table 2. Changes to nested classes for Notification.Builder
Nested classes | Effect | Description |
---|---|---|
|
Not used | Only summary text will show. Detailed notifications for these styles are not supported. |
Notification.BubbleMetadata |
Not used | Bubbles are not supported. |
Notification.MediaStyle |
Hidden | Notifications with this style are hidden. Android Automotive OS manages user interface interactions for media notifications and playback. |
Notification.MessagingStyle |
Behavior changed |
Notifications with this style have the following differences:
|
|
Not used | Extenders are not supported. |
Notification.Action.Builder
The following table describes the API changes and restrictions in the
Notification.Action.Builder
class.
Table 3. Changes to public methods for Notification.Action.Builder
Public methods | Effect | Description |
---|---|---|
Public constructors | Behavior changed | Icons specified in public constructors are ignored. |
addRemoteInput |
Behavior changed | To minimize driver distraction, a digital assistant (such as the Google Assistant) inserts the response to a message for the user. Users are not allowed to type messages. |
setAllowGeneratedReplies |
No-op | Smart Reply is not supported. |