# PlayerNotificationManager.Builder

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

*** ** * ** ***


```
public class PlayerNotificationManager.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager` instances.

## Summary

| ### Protected fields |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#channelDescriptionResourceId()` |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#channelId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#channelImportance()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#channelNameResourceId()` |
| `final https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#context()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.CustomActionReceiver` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#customActionReceiver()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#fastForwardActionIconResourceId()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#groupKey()` |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#mediaDescriptionAdapter()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#nextActionIconResourceId()` |
| `final int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#notificationId()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#notificationListener()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#pauseActionIconResourceId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#playActionIconResourceId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#previousActionIconResourceId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#rewindActionIconResourceId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#smallIconResourceId()` |
| `int` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#stopActionIconResourceId()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#Builder(android.content.Context,int,java.lang.String)( https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int notificationId, https://developer.android.com/reference/java/lang/String.html channelId )` Creates an instance. |
| `[Builder](https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#Builder(android.content.Context,int,java.lang.String,androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter))( https://developer.android.com/reference/android/content/Context.html context, int notificationId, https://developer.android.com/reference/java/lang/String.html channelId, https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#Builder(android.content.Context,int,java.lang.String)` instead, then call `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setMediaDescriptionAdapter(androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter)`. <br /> |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#build()()` Builds the `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelDescriptionResourceId(int)(int channelDescriptionResourceId)` The description of the channel. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelImportance(int)(@https://developer.android.com/reference/androidx/media3/common/util/NotificationUtil.Importance int channelImportance)` The importance of the channel. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelNameResourceId(int)(int channelNameResourceId)` The name of the channel. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setCustomActionReceiver(androidx.media3.ui.PlayerNotificationManager.CustomActionReceiver)( https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.CustomActionReceiver customActionReceiver )` The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.CustomActionReceiver` to be used. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setFastForwardActionIconResourceId(int)( int fastForwardActionIconResourceId )` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_FAST_FORWARD()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setGroup(java.lang.String)(https://developer.android.com/reference/java/lang/String.html groupKey)` The key of the group the media notification should belong to. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setMediaDescriptionAdapter(androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter)( https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter )` The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter` to be queried for the notification contents. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setNextActionIconResourceId(int)(int nextActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_NEXT()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setNotificationListener(androidx.media3.ui.PlayerNotificationManager.NotificationListener)( https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener notificationListener )` The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener` to be used. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setPauseActionIconResourceId(int)(int pauseActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PAUSE()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setPlayActionIconResourceId(int)(int playActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PLAY()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setPreviousActionIconResourceId(int)(int previousActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PREVIOUS()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setRewindActionIconResourceId(int)(int rewindActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_REWIND()`. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setSmallIconResourceId(int)(int smallIconResourceId)` The resource id of the small icon of the notification shown in the status bar. |
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setStopActionIconResourceId(int)(int stopActionIconResourceId)` The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_STOP()`. |

## Protected fields

### channelDescriptionResourceId

```
protected int channelDescriptionResourceId
```

### channelId

```
protected final String channelId
```

### channelImportance

```
protected int channelImportance
```

### channelNameResourceId

```
protected int channelNameResourceId
```

### context

```
protected final Context context
```

### customActionReceiver

```
protected @Nullable PlayerNotificationManager.CustomActionReceiver customActionReceiver
```

### fastForwardActionIconResourceId

```
protected int fastForwardActionIconResourceId
```

### groupKey

```
protected @Nullable String groupKey
```

### mediaDescriptionAdapter

```
protected PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
```

### nextActionIconResourceId

```
protected int nextActionIconResourceId
```

### notificationId

```
protected final int notificationId
```

### notificationListener

```
protected @Nullable PlayerNotificationManager.NotificationListener notificationListener
```

### pauseActionIconResourceId

```
protected int pauseActionIconResourceId
```

### playActionIconResourceId

```
protected int playActionIconResourceId
```

### previousActionIconResourceId

```
protected int previousActionIconResourceId
```

### rewindActionIconResourceId

```
protected int rewindActionIconResourceId
```

### smallIconResourceId

```
protected int smallIconResourceId
```

### stopActionIconResourceId

```
protected int stopActionIconResourceId
```

## Public constructors

### Builder

```
public Builder(
    Context context,
    @IntRange(from = 1) int notificationId,
    String channelId
)
```

Creates an instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | The `https://developer.android.com/reference/android/content/Context.html`. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int notificationId` | The id of the notification to be posted. Must be greater than 0. |
| `https://developer.android.com/reference/java/lang/String.html channelId` | The id of the notification channel of an existing notification channel or of the channel that should be automatically created. In the latter case, `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelNameResourceId(int)` needs to be called as well. |

### Builder

```
public [Builder](https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#Builder(android.content.Context,int,java.lang.String,androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter))(
    Context context,
    int notificationId,
    String channelId,
    PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#Builder(android.content.Context,int,java.lang.String)` instead, then call `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setMediaDescriptionAdapter(androidx.media3.ui.PlayerNotificationManager.MediaDescriptionAdapter)`.

## Public methods

### build

```
public PlayerNotificationManager build()
```

Builds the `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager`.

### setChannelDescriptionResourceId

```
public PlayerNotificationManager.Builder setChannelDescriptionResourceId(int channelDescriptionResourceId)
```

The description of the channel. Ignored if `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelNameResourceId(int)` is not called with a value other than `0`. If the application has already created the notification channel, then this method should not be called.

The default is `0`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setChannelImportance

```
public PlayerNotificationManager.Builder setChannelImportance(@NotificationUtil.Importance int channelImportance)
```

The importance of the channel. Ignored if `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#setChannelNameResourceId(int)` is not called with a value other than `0`. If the application has already created the notification channel, then this method should not be called.

The default is `https://developer.android.com/reference/androidx/media3/common/util/NotificationUtil#IMPORTANCE_LOW()`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setChannelNameResourceId

```
public PlayerNotificationManager.Builder setChannelNameResourceId(int channelNameResourceId)
```

The name of the channel. If set to a value other than `0`, the channel is automatically created when `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder#build()` is called. If the application has already created the notification channel, then this method should not be called.

The default is `0`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setCustomActionReceiver

```
public PlayerNotificationManager.Builder setCustomActionReceiver(
    PlayerNotificationManager.CustomActionReceiver customActionReceiver
)
```

The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.CustomActionReceiver` to be used.

The default is `null`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setFastForwardActionIconResourceId

```
public PlayerNotificationManager.Builder setFastForwardActionIconResourceId(
    int fastForwardActionIconResourceId
)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_FAST_FORWARD()`.

The default is `R.drawable#exo_notification_fastforward`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setGroup

```
public PlayerNotificationManager.Builder setGroup(String groupKey)
```

The key of the group the media notification should belong to.

The default is `null`

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setMediaDescriptionAdapter

```
public PlayerNotificationManager.Builder setMediaDescriptionAdapter(
    PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
)
```

The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.MediaDescriptionAdapter` to be queried for the notification contents.

The default is `https://developer.android.com/reference/androidx/media3/ui/DefaultMediaDescriptionAdapter` with no `https://developer.android.com/reference/android/app/PendingIntent.html`

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setNextActionIconResourceId

```
public PlayerNotificationManager.Builder setNextActionIconResourceId(int nextActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_NEXT()`.

The default is `R.drawable#exo_notification_next`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setNotificationListener

```
public PlayerNotificationManager.Builder setNotificationListener(
    PlayerNotificationManager.NotificationListener notificationListener
)
```

The `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener` to be used.

The default is `null`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setPauseActionIconResourceId

```
public PlayerNotificationManager.Builder setPauseActionIconResourceId(int pauseActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PAUSE()`.

The default is `R.drawable#exo_notification_pause`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setPlayActionIconResourceId

```
public PlayerNotificationManager.Builder setPlayActionIconResourceId(int playActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PLAY()`.

The default is `R.drawable#exo_notification_play`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setPreviousActionIconResourceId

```
public PlayerNotificationManager.Builder setPreviousActionIconResourceId(int previousActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_PREVIOUS()`.

The default is `R.drawable#exo_notification_previous`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setRewindActionIconResourceId

```
public PlayerNotificationManager.Builder setRewindActionIconResourceId(int rewindActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_REWIND()`.

The default is `R.drawable#exo_notification_rewind`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setSmallIconResourceId

```
public PlayerNotificationManager.Builder setSmallIconResourceId(int smallIconResourceId)
```

The resource id of the small icon of the notification shown in the status bar. See `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)`.

The default is `R.drawable#exo_notification_small_icon`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |

### setStopActionIconResourceId

```
public PlayerNotificationManager.Builder setStopActionIconResourceId(int stopActionIconResourceId)
```

The resource id of the drawable to be used as the icon of action `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager#ACTION_STOP()`.

The default is `R.drawable#exo_notification_stop`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.Builder` | This builder. |