# Notification.CarExtender.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                               ||
| ↳ | [android.app.Notification.CarExtender.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.

## Summary

|                                                                                                                                                                                          Public constructors                                                                                                                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#Builder(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs a new builder for[CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation). |

|                                                                                                                                                                                                                                                                                                                           Public methods                                                                                                                                                                                                                                                                                                                            ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Notification.CarExtender.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#)!                      | [addMessage](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#addMessage(kotlin.String))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Appends a new unread message to the list of messages for this conversation.                                                                                                                                                                                       |
| open[Notification.CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation)! | [build](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#build())`()` Builds a new unread conversation object.                                                                                                                                                                                                                                                                                                                                               |
| open[Notification.CarExtender.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#)!                      | [setLatestTimestamp](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#setLatestTimestamp(kotlin.Long))`(`timestamp:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the timestamp of the most recent message in an unread conversation.                                                                                                                                                                               |
| open[Notification.CarExtender.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#)!                      | [setReadPendingIntent](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#setReadPendingIntent(android.app.PendingIntent))`(`pendingIntent:` `[PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!`)` Sets the pending intent that will be sent once the messages in this notification are read.                                                                                                                         |
| open[Notification.CarExtender.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#)!                      | [setReplyAction](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.Builder#setReplyAction(android.app.PendingIntent,%20android.app.RemoteInput))`(`pendingIntent:` `[PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!`, `remoteInput:` `[RemoteInput](https://developer.android.com/reference/kotlin/android/app/RemoteInput)!`)` Sets the pending intent and remote input which will convey the reply to this notification. |

## Public constructors

### Builder

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

```
Builder(name: String!)
```

Constructs a new builder for[CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation).

|                                                                   Parameters                                                                    ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the other participant in the conversation |

## Public methods

### addMessage

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

```
open fun addMessage(message: String!): Notification.CarExtender.Builder!
```

Appends a new unread message to the list of messages for this conversation.

The messages should be added from oldest to newest.

|                                                           Parameters                                                            ||
|-----------|----------------------------------------------------------------------------------------------------------------------|
| `message` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the text of the new unread message |

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

### build

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

```
open fun build(): Notification.CarExtender.UnreadConversation!
```

Builds a new unread conversation object.

|                                                                                           Return                                                                                           ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Notification.CarExtender.UnreadConversation](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation)! | the new unread conversation object |

### setLatestTimestamp

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

```
open fun setLatestTimestamp(timestamp: Long): Notification.CarExtender.Builder!
```

Sets the timestamp of the most recent message in an unread conversation.

If a messaging notification has been posted by your application and has not yet been cancelled, posting a later notification with the same id and tag but without a newer timestamp may result in Android Auto not displaying a heads up notification for the later notification.

|                                                                       Parameters                                                                       ||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `timestamp` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):the timestamp of the most recent message in the conversation |

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

### setReadPendingIntent

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

```
open fun setReadPendingIntent(pendingIntent: PendingIntent!): Notification.CarExtender.Builder!
```

Sets the pending intent that will be sent once the messages in this notification are read.

|                                                              Parameters                                                               ||
|-----------------|----------------------------------------------------------------------------------------------------------------------|
| `pendingIntent` | [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!:the pending intent to use |

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

### setReplyAction

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

```
open fun setReplyAction(
    pendingIntent: PendingIntent!, 
    remoteInput: RemoteInput!
): Notification.CarExtender.Builder!
```

Sets the pending intent and remote input which will convey the reply to this notification.

|                                                                            Parameters                                                                             ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| `pendingIntent` | [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!:the pending intent which will be triggered on a reply |
| `remoteInput`   | [RemoteInput](https://developer.android.com/reference/kotlin/android/app/RemoteInput)!:the remote input parcelable which will carry the reply    |

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

**See Also**

- [android.app.Notification.CarExtender.UnreadConversation#getRemoteInput](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation#getRemoteInput())
- [android.app.Notification.CarExtender.UnreadConversation#getReplyPendingIntent](https://developer.android.com/reference/kotlin/android/app/Notification.CarExtender.UnreadConversation#getReplyPendingIntent())