public final class CarNotificationManager
extends Object


A manager for car apps to send notifications. This class wraps a NotificationManagerCompat to manage the actual sending of the Notification.


Public methods

boolean areNotificationsEnabled()

Returns whether notifications from the calling package are not blocked.

void cancel(String tag, int id)

Cancels a previously shown notification.

void cancel(int id)

Cancels a previously shown notification.

void cancelAll()

Cancels all previously shown notifications.

void createNotificationChannel(NotificationChannelCompat channel)

Creates a notification channel that notifications can be posted to.

void createNotificationChannelGroup(NotificationChannelGroupCompat group)

Creates a group container for NotificationChannel objects.

void createNotificationChannelGroups(List<NotificationChannelGroupCompat> groups)

Creates multiple notification channel groups.

void createNotificationChannels(List<NotificationChannelCompat> channels)

Creates multiple notification channels that different notifications can be posted to.

void deleteNotificationChannel(String channelId)

Deletes the given notification channel.

void deleteNotificationChannelGroup(String groupId)

Deletes the given notification channel group, and all notification channels that belong to it.

void deleteUnlistedNotificationChannels(Collection<String> channelIds)

Deletes notification channels for which ids are NOT given.

static CarNotificationManager from(Context context)

Returns a CarNotificationManager instance for a provided context.

static Set<String> getEnabledListenerPackages(Context context)

Get the set of packages that have an enabled notification listener component within them.