# DefaultMediaNotificationProvider

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/DefaultMediaNotificationProvider.java+class:androidx.media3.session.DefaultMediaNotificationProvider)

*** ** * ** ***

<br />

```
@UnstableApi
class DefaultMediaNotificationProvider : MediaNotification.Provider
```

<br />

*** ** * ** ***

The default `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider`.

## Actions

The following actions are included in the provided notifications:

- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_PLAY_PAUSE()` to start or pause playback.
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS()` to seek to the previous item.
- `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT()` to seek to the next item.

## Custom commands

Custom actions are sent to the session under the hood. You can receive them by overriding the session callback method `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession.Callback#onCustomCommand(androidx.media3.session.MediaSession,androidx.media3.session.MediaSession.ControllerInfo,androidx.media3.session.SessionCommand,android.os.Bundle)`. This is useful because starting with Android 13, the System UI notification sends commands directly to the session. So handling the custom commands on the session level allows you to handle them at the same callback for all API levels.

## Drawables

The drawables used can be overridden by drawables with the same file names in ` res/drawables` of the application module. Alternatively, you can override the drawable resource ID with a `drawable` element in a resource file in `res/values`. The drawable resource IDs are:

- **`media3_icon_play`** - The play icon.
- **`media3_icon_pause`** - The pause icon.
- **`media3_icon_previous`** - The previous icon.
- **`media3_icon_next`** - The next icon.
- **`media3_notification_small_icon`** - The `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)`. A different icon can be set with `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#setSmallIcon(int)`.

## String resources

String resources used can be overridden by resources with the same resource IDs defined by the application. The string resource IDs are:

- **`media3_controls_play_description`** - The description of the play icon.
- **`media3_controls_pause_description`** - The description of the pause icon.
- **`media3_controls_seek_to_previous_description`** - The description of the previous icon.
- **`media3_controls_seek_to_next_description`** - The description of the next icon.
- **`default_notification_channel_name`** The name of the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted. A different string resource can be set when constructing the provider with `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setChannelName(int)`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder` A builder for `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider` instances. |
| `interface https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.NotificationIdProvider` Provides notification IDs for posting media notifications for given media sessions. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#COMMAND_KEY_COMPACT_VIEW_INDEX() = "androidx.media3.session.command.COMPACT_VIEW_INDEX"` An extras key that can be used to define the index of a `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` in `https://developer.android.com/reference/android/app/Notification.MediaStyle.html#setShowActionsInCompactView(int...)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_CHANNEL_ID() = "default_channel_id"` The default ID used for the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. |
| `const @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_CHANNEL_NAME_RESOURCE_ID()` The default name used for the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_NOTIFICATION_ID() = 1001` The default ID used for the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#GROUP_KEY() = "media3_group_key"` The group key used for the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)` to avoid the media notification being auto-grouped with the other notifications. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DefaultMediaNotificationProvider(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates an instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DefaultMediaNotificationProvider(android.content.Context,androidx.media3.session.DefaultMediaNotificationProvider.NotificationIdProvider,java.lang.String,int)( context: https://developer.android.com/reference/android/content/Context.html!, notificationIdProvider: https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.NotificationIdProvider!, channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, channelNameResourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#createNotification(androidx.media3.session.MediaSession,com.google.common.collect.ImmutableList<androidx.media3.session.CommandButton>,androidx.media3.session.MediaNotification.ActionFactory,androidx.media3.session.MediaNotification.Provider.Callback)( mediaSession: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!, mediaButtonPreferences: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!, actionFactory: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory!, onNotificationChangedCallback: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider.Callback! )` Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider.NotificationChannelInfo!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#getNotificationChannelInfo()()` Returns the info of the notification channel used when creating a notification. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#handleCustomCommand(androidx.media3.session.MediaSession,java.lang.String,android.os.Bundle)(session: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!, action: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, extras: https://developer.android.com/reference/android/os/Bundle.html!)` Handles a notification's custom command. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#setSmallIcon(int)(smallIconResourceId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the small icon of the notification which is also shown in the system status bar. |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#addNotificationActions(androidx.media3.session.MediaSession,com.google.common.collect.ImmutableList<androidx.media3.session.CommandButton>,androidx.core.app.NotificationCompat.Builder,androidx.media3.session.MediaNotification.ActionFactory)( mediaSession: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!, mediaButtons: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!, builder: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder!, actionFactory: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory! )` Adds the media buttons to the notification builder for the given action factory. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#getMediaButtons(androidx.media3.session.MediaSession,androidx.media3.common.Player.Commands,com.google.common.collect.ImmutableList<androidx.media3.session.CommandButton>,boolean)( session: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!, playerCommands: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands!, mediaButtonPreferences: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!, showPauseButton: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns the ordered list of `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` to be used to build the notification. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#getNotificationContentText(androidx.media3.common.MediaMetadata)(metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!)` Returns the content text to be used to build the notification. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#getNotificationContentTitle(androidx.media3.common.MediaMetadata)(metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!)` Returns the content title to be used to build the notification. |

## Constants

### COMMAND_KEY_COMPACT_VIEW_INDEX

```
const val COMMAND_KEY_COMPACT_VIEW_INDEX = "androidx.media3.session.command.COMPACT_VIEW_INDEX": String!
```

An extras key that can be used to define the index of a `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` in `https://developer.android.com/reference/android/app/Notification.MediaStyle.html#setShowActionsInCompactView(int...)`.

### DEFAULT_CHANNEL_ID

```
const val DEFAULT_CHANNEL_ID = "default_channel_id": String!
```

The default ID used for the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on.

### DEFAULT_CHANNEL_NAME_RESOURCE_ID

```
const val DEFAULT_CHANNEL_NAME_RESOURCE_ID: @StringRes Int
```

The default name used for the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on.

### DEFAULT_NOTIFICATION_ID

```
const val DEFAULT_NOTIFICATION_ID = 1001: Int
```

The default ID used for the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()`.

### GROUP_KEY

```
const val GROUP_KEY = "media3_group_key": String!
```

The group key used for the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)` to avoid the media notification being auto-grouped with the other notifications. The other notifications sent from the app shouldn't use this group key.

## Public constructors

### DefaultMediaNotificationProvider

```
DefaultMediaNotificationProvider(context: Context!)
```

Creates an instance. Use this constructor only when you want to override methods of this class. Otherwise use `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder`.

### DefaultMediaNotificationProvider

```
DefaultMediaNotificationProvider(
    context: Context!,
    notificationIdProvider: DefaultMediaNotificationProvider.NotificationIdProvider!,
    channelId: String!,
    channelNameResourceId: Int
)
```

Creates an instance. Use this constructor only when you want to override methods of this class. Otherwise use `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder`.

## Public functions

### createNotification

```
fun createNotification(
    mediaSession: MediaSession!,
    mediaButtonPreferences: ImmutableList<CommandButton!>!,
    actionFactory: MediaNotification.ActionFactory!,
    onNotificationChangedCallback: MediaNotification.Provider.Callback!
): MediaNotification!
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification`.

| Parameters |
|---|---|
| `mediaSession: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!` | The media session. |
| `mediaButtonPreferences: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The media button preferences `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession#setMediaButtonPreferences(androidx.media3.session.MediaSession.ControllerInfo,java.util.List<androidx.media3.session.CommandButton>)`. |
| `actionFactory: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory` for creating notification `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Action`. |
| `onNotificationChangedCallback: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider.Callback!` | A callback that the provider needs to notify when the notification has changed and needs to be posted again, for example after a bitmap has been loaded asynchronously. |

### getNotificationChannelInfo

```
fun getNotificationChannelInfo(): MediaNotification.Provider.NotificationChannelInfo!
```

Returns the info of the notification channel used when creating a notification.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider.NotificationChannelInfo!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.Provider.NotificationChannelInfo`. |

### handleCustomCommand

```
fun handleCustomCommand(session: MediaSession!, action: String!, extras: Bundle!): Boolean
```

Handles a notification's custom command.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!` | The media session. |
| `action: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The custom command action. |
| `extras: https://developer.android.com/reference/android/os/Bundle.html!` | A bundle `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionCommand#customExtras()`, otherwise `https://developer.android.com/reference/android/os/Bundle.html#EMPTY`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `false` if the action should be delivered to the session as a custom command or `true` if the action has been handled completely by the provider. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory#createCustomAction(androidx.media3.session.MediaSession,androidx.core.graphics.drawable.IconCompat,java.lang.CharSequence,java.lang.String,android.os.Bundle)` |   |

### setSmallIcon

```
fun setSmallIcon(smallIconResourceId: @DrawableRes Int): Unit
```

Sets the small icon of the notification which is also shown in the system status bar.

| Parameters |
|---|---|
| `smallIconResourceId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The resource id of the small icon. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)` |   |

## Protected functions

### addNotificationActions

```
protected fun addNotificationActions(
    mediaSession: MediaSession!,
    mediaButtons: ImmutableList<CommandButton!>!,
    builder: NotificationCompat.Builder!,
    actionFactory: MediaNotification.ActionFactory!
): Array<Int>!
```

Adds the media buttons to the notification builder for the given action factory.

The list of `mediaButtons` is the list resulting from `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#getMediaButtons(androidx.media3.session.MediaSession,androidx.media3.common.Player.Commands,com.google.common.collect.ImmutableList<androidx.media3.session.CommandButton>,boolean)`.

Override this method to customize how the media buttons `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(androidx.core.app.NotificationCompat.Action)` to the notification and define which actions are shown in compact view by returning the indices of the buttons to be shown in compact view.

By default, the buttons for `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToPreviousMediaItem()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#play()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#pause()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToNextMediaItem()` are shown in compact view, unless some of the buttons are marked with `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#COMMAND_KEY_COMPACT_VIEW_INDEX()` to declare the index in compact view of the given command button in the button extras.

| Parameters |
|---|---|
| `mediaSession: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!` | The media session to which the actions will be sent. |
| `mediaButtons: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The command buttons to be included in the notification. |
| `builder: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder!` | The builder to add the actions to. |
| `actionFactory: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification.ActionFactory!` | The actions factory to be used to build notifications. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The indices of the buttons to be `https://developer.android.com/reference/android/app/Notification.MediaStyle.html#setShowActionsInCompactView(int...)`. |

### getMediaButtons

```
protected fun getMediaButtons(
    session: MediaSession!,
    playerCommands: Player.Commands!,
    mediaButtonPreferences: ImmutableList<CommandButton!>!,
    showPauseButton: Boolean
): ImmutableList<CommandButton!>!
```

Returns the ordered list of `https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton` to be used to build the notification.

This method is called each time a new notification is built.

Override this method to customize the buttons on the notification. Commands of the buttons returned by this method must be contained in `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaController#getAvailableCommands()`.

By default, the notification shows buttons for `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToPreviousMediaItem()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#play()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#pause()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToNextMediaItem()` in `https://developer.android.com/reference/android/app/Notification.MediaStyle.html#setShowActionsInCompactView(int...)`. This can be customized by defining the index of the command in compact view of up to 3 commands in their extras with key `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#COMMAND_KEY_COMPACT_VIEW_INDEX()`.

To make the media button preferences and custom commands work, you need to `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession#setMediaButtonPreferences(androidx.media3.session.MediaSession.ControllerInfo,java.util.List<androidx.media3.session.CommandButton>)` and add the custom commands to the available commands when a controller `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession.Callback#onConnectAsync(androidx.media3.session.MediaSession,androidx.media3.session.MediaSession.ControllerInfo)`. Controllers that connect after you called `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession#setMediaButtonPreferences(androidx.media3.session.MediaSession.ControllerInfo,java.util.List<androidx.media3.session.CommandButton>)` need the custom command set in `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession.Callback#onPostConnect(androidx.media3.session.MediaSession,androidx.media3.session.MediaSession.ControllerInfo)` too.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession!` | The media session. |
| `playerCommands: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands!` | The available player commands. |
| `mediaButtonPreferences: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaSession#setMediaButtonPreferences(androidx.media3.session.MediaSession.ControllerInfo,java.util.List<androidx.media3.session.CommandButton>)`. |
| `showPauseButton: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the notification should show a pause button (e.g., because the player is currently playing content), otherwise show a play button to start playback. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/session/CommandButton!>!` | The ordered list of command buttons to be placed on the notification. |

### getNotificationContentText

```
protected fun getNotificationContentText(metadata: MediaMetadata!): CharSequence?
```

Returns the content text to be used to build the notification.

This method is called each time a new notification is built.

Override this method to customize which field of `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata` is used for content text of the notification.

By default, the notification shows `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#artist()` as content text.

| Parameters |
|---|---|
| `metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!` | The media metadata from which content text is fetched. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | Notification content text. |

### getNotificationContentTitle

```
protected fun getNotificationContentTitle(metadata: MediaMetadata!): CharSequence?
```

Returns the content title to be used to build the notification.

This method is called each time a new notification is built.

Override this method to customize which field of `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata` is used for content title of the notification.

By default, the notification shows `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#title()` as content title.

| Parameters |
|---|---|
| `metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!` | The media metadata from which content title is fetched. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | Notification content title. |