# Notification.CarExtender

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

# CarExtender

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/Notification.CarExtender "View this page in Java")  

```
class CarExtender : Notification.Extender
```

|---|------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                               ||
| ↳ | [android.app.Notification.CarExtender](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#) |

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

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

```kotlin
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                                                                                                                                ||
|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder) Builder class for[CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation)objects. |
|   | [UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation) A class which holds the unread messages from a conversation.                                                                                |

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

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

## Public constructors

### CarExtender

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

```
CarExtender()
```

Create a[CarExtender](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#)with default options.  

### CarExtender

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

```
CarExtender(notif: Notification!)
```

Create a[CarExtender](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#)from the CarExtender options of an existing Notification.

|                                                                  Parameters                                                                   ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------|
| `notif` | [Notification](https://developer.android.com/reference/kotlin/android/app/Notification)!:the notification from which to copy options |

## Public methods

### extend

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

```
fun extend(builder: Notification.Builder!): Notification.Builder!
```

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

|                                                                   Parameters                                                                   ||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------|
| `builder` | [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder)!:the builder to be modified |

|                                                                 Return                                                                  ||
|----------------------------------------------------------------------------------------------------------|-------------------------------|
| [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder)! | the build object for chaining |

### getColor

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

```
fun getColor(): Int
```

Gets the accent color.  
**See Also**

- [#setColor](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#setColor(kotlin.Int))  

### getLargeIcon

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

```
fun getLargeIcon(): Bitmap!
```

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

|                                                              Return                                                              ||
|-----------------------------------------------------------------------------------------|-----------------------------------------|
| [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)! | the large icon for the car notification |

**See Also**

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

### getUnreadConversation

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

```
fun getUnreadConversation(): Notification.CarExtender.UnreadConversation!
```

Returns the unread conversation conveyed by this notification.  
**See Also**

- [#setUnreadConversation(UnreadConversation)](https://developer.android.com/reference/kotlin/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.html#ApiLevels)  

```
fun setColor(color: Int): Notification.CarExtender!
```

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

Android Auto uses the color set with[Notification.Builder.setColor(int)](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setColor(kotlin.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.  

### setLargeIcon

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

```
fun setLargeIcon(largeIcon: Bitmap!): Notification.CarExtender!
```

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[Notification.Builder.setLargeIcon(android.graphics.Bitmap)](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLargeIcon(android.graphics.Bitmap))

|                                                                     Parameters                                                                     ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `largeIcon` | [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)!:the large icon to use in the car notification |

|                                                                       Return                                                                       ||
|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| [Notification.CarExtender](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#)! | this object for method chaining |

### setUnreadConversation

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

```
fun setUnreadConversation(unreadConversation: Notification.CarExtender.UnreadConversation!): Notification.CarExtender!
```

Sets the unread conversation in a message notification.

|                                                                                                                 Parameters                                                                                                                 ||
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `unreadConversation` | [Notification.CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation)!:the unread part of the conversation this notification conveys |

|                                                                       Return                                                                       ||
|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| [Notification.CarExtender](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender#)! | this object for method chaining |