Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/Notification.CarExtender#nestedclasses) \| [Ctors](https://developer.android.com/reference/android/app/Notification.CarExtender#pubctors) \| [Methods](https://developer.android.com/reference/android/app/Notification.CarExtender#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/Notification.CarExtender#inhmethods)

# Notification.CarExtender

*** ** * ** ***

` public static final class Notification.CarExtender `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/app/Notification.Extender `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.Notification.CarExtender |

<br />

*** ** * ** ***

<br />

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

1. Create an `https://developer.android.com/reference/android/app/Notification.Builder`, setting any desired properties.
2. Create a `https://developer.android.com/reference/android/app/Notification.CarExtender`.
3. Set car-specific properties using the `add` and `set` methods of `https://developer.android.com/reference/android/app/Notification.CarExtender`.
4. Call `https://developer.android.com/reference/android/app/Notification.Builder#extend(android.app.Notification.Extender)` to apply the extensions to a notification.

```
Notification notification = new Notification.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

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/app/Notification.CarExtender.Builder` Builder class for `https://developer.android.com/reference/android/app/Notification.CarExtender.UnreadConversation` objects. |
| ` class` | `https://developer.android.com/reference/android/app/Notification.CarExtender.UnreadConversation` A class which holds the unread messages from a conversation. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/Notification.CarExtender#CarExtender()() ` Create a `https://developer.android.com/reference/android/app/Notification.CarExtender` with default options. |
| ` https://developer.android.com/reference/android/app/Notification.CarExtender#CarExtender(android.app.Notification)(https://developer.android.com/reference/android/app/Notification notif) ` Create a `https://developer.android.com/reference/android/app/Notification.CarExtender` from the CarExtender options of an existing Notification. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/Notification.Builder` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#extend(android.app.Notification.Builder)(https://developer.android.com/reference/android/app/Notification.Builder builder) ` Apply car extensions to a notification that is being built. |
| ` int` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#getColor()() ` Gets the accent color. |
| ` https://developer.android.com/reference/android/graphics/Bitmap` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#getLargeIcon()() ` Gets the large icon used in this car notification, or `null` if no icon has been set. |
| ` https://developer.android.com/reference/android/app/Notification.CarExtender.UnreadConversation` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#getUnreadConversation()() ` Returns the unread conversation conveyed by this notification. |
| ` https://developer.android.com/reference/android/app/Notification.CarExtender` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#setColor(int)(int color) ` Sets the accent color to use when Android Auto presents the notification. |
| ` https://developer.android.com/reference/android/app/Notification.CarExtender` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#setLargeIcon(android.graphics.Bitmap)(https://developer.android.com/reference/android/graphics/Bitmap largeIcon) ` Sets the large icon of the car notification. |
| ` https://developer.android.com/reference/android/app/Notification.CarExtender` | ` https://developer.android.com/reference/android/app/Notification.CarExtender#setUnreadConversation(android.app.Notification.CarExtender.UnreadConversation)(https://developer.android.com/reference/android/app/Notification.CarExtender.UnreadConversation unreadConversation) ` Sets the unread conversation in a message notification. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/app/Notification.Extender ` ` abstract https://developer.android.com/reference/android/app/Notification.Builder` ` https://developer.android.com/reference/android/app/Notification.Extender#extend(android.app.Notification.Builder)(https://developer.android.com/reference/android/app/Notification.Builder builder) `

Apply this extender to a notification builder.

## Public constructors

### CarExtender

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CarExtender ()
```

Create a `https://developer.android.com/reference/android/app/Notification.CarExtender` with default options.

<br />

### CarExtender

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CarExtender (Notification notif)
```

Create a `https://developer.android.com/reference/android/app/Notification.CarExtender` from the CarExtender options of an existing Notification.

<br />

| Parameters ||
|---|---|
| `notif` | `Notification`: the notification from which to copy options <br /> |

## Public methods

### extend

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.Builder extend (Notification.Builder builder)
```

Apply car extensions to a notification that is being built. This is typically called by the `https://developer.android.com/reference/android/app/Notification.Builder#extend(android.app.Notification.Extender)` method of `https://developer.android.com/reference/android/app/Notification.Builder`.

<br />

| Parameters ||
|---|---|
| `builder` | `Notification.Builder`: the builder to be modified. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.Builder` | the build object for chaining. This value cannot be `null`. <br /> |

### getColor

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getColor ()
```

Gets the accent color.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Notification.CarExtender#setColor(int)`

### getLargeIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bitmap getLargeIcon ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap` | the large icon for the car notification <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Notification.CarExtender#setLargeIcon(android.graphics.Bitmap)`

### getUnreadConversation

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.CarExtender.UnreadConversation getUnreadConversation ()
```

Returns the unread conversation conveyed by this notification.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.CarExtender.UnreadConversation` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Notification.CarExtender#setUnreadConversation(android.app.Notification.CarExtender.UnreadConversation)`

### setColor

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.CarExtender setColor (int color)
```

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

Android Auto uses the color set with `https://developer.android.com/reference/android/app/Notification.Builder#setColor(int)` to accent the displayed notification. However, not all colors are acceptable in an automotive setting. This method can be used to override the color provided in the notification in such a situation.

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.CarExtender` | <br /> |

### setLargeIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.CarExtender setLargeIcon (Bitmap largeIcon)
```

Sets the large icon of the car notification.

If no large icon is set in the extender, Android Auto will display the icon specified by `https://developer.android.com/reference/android/app/Notification.Builder#setLargeIcon(android.graphics.Bitmap)`

<br />

| Parameters ||
|---|---|
| `largeIcon` | `Bitmap`: the large icon to use in the car notification <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.CarExtender` | this object for method chaining <br /> |

### setUnreadConversation

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.CarExtender setUnreadConversation (Notification.CarExtender.UnreadConversation unreadConversation)
```

Sets the unread conversation in a message notification.

<br />

| Parameters ||
|---|---|
| `unreadConversation` | `Notification.CarExtender.UnreadConversation`: the unread part of the conversation this notification conveys <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.CarExtender` | this object for method chaining <br /> |