NotificationCompat.CarExtender

public final class NotificationCompat.CarExtender implements NotificationCompat.Extender


Helper class to add Android Auto extensions to notifications. To create a notification with car extensions:

  1. Create an NotificationCompat.Builder, setting any desired properties.
  2. Create a CarExtender.
  3. Set car-specific properties using the add and set methods of CarExtender.
  4. Call extend to apply the extensions to a notification.
  5. Post the notification to the notification system with the NotificationManagerCompat.notify(...) methods and not the NotificationManager.notify(...) methods.
Notification notification = new NotificationCompat.Builder(context)
        ...
        .extend(new CarExtender()
                .set*(...))
        .build();

Car extensions can be accessed on an existing notification by using the CarExtender(Notification) constructor, and then using the get methods to access values.

Summary

Public constructors

Create a CarExtender with default options.

Create a CarExtender from the CarExtender options of an existing Notification.

Public methods

@Override @NonNull NotificationCompat.Builder

Apply car extensions to a notification that is being built.

@ColorInt int

Gets the accent color.

@Nullable Bitmap

Gets the large icon used in this car notification, or null if no icon has been set.

@Nullable NotificationCompat.CarExtender.UnreadConversation

This method is deprecated.

UnreadConversation is no longer supported.

@NonNull NotificationCompat.CarExtender
setColor(@ColorInt int color)

Sets the accent color to use when Android Auto presents the notification.