# DefaultMediaNotificationProvider.Builder

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.Builder)

*** ** * ** ***


```
class DefaultMediaNotificationProvider.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#Builder(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates a builder. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#build()()` Builds the `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setChannelId(java.lang.String)(channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Sets the ID of the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setChannelName(int)(channelNameResourceId: @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the name of the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setNotificationId(int)(notificationId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()` used for the created notifications. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setNotificationIdProvider(androidx.media3.session.DefaultMediaNotificationProvider.NotificationIdProvider)( notificationIdProvider: https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.NotificationIdProvider! )` Sets the provider for the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()` used for the created notifications. |

## Public constructors

### Builder

```
Builder(context: Context!)
```

Creates a builder.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | Any `https://developer.android.com/reference/android/content/Context.html`. |

## Public functions

### build

```
fun build(): DefaultMediaNotificationProvider!
```

Builds the `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider`. The method can be called at most once.

### setChannelId

```
@CanIgnoreReturnValue
fun setChannelId(channelId: String!): DefaultMediaNotificationProvider.Builder!
```

Sets the ID of the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. By default, this is set to `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_CHANNEL_ID()`.

| Parameters |
|---|---|
| `channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The channel ID. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | This builder. |

### setChannelName

```
@CanIgnoreReturnValue
fun setChannelName(channelNameResourceId: @StringRes Int): DefaultMediaNotificationProvider.Builder!
```

Sets the name of the `https://developer.android.com/reference/android/app/NotificationChannel.html` on which created notifications are posted on. By default, this is set to `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_CHANNEL_NAME_RESOURCE_ID()`.

| Parameters |
|---|---|
| `channelNameResourceId: @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The string resource ID with the channel name. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | This builder. |

### setNotificationId

```
@CanIgnoreReturnValue
fun setNotificationId(notificationId: Int): DefaultMediaNotificationProvider.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()` used for the created notifications. By default, this is set to `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_NOTIFICATION_ID()`.

Overwrites anything set in `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setNotificationIdProvider(androidx.media3.session.DefaultMediaNotificationProvider.NotificationIdProvider)`.

| Parameters |
|---|---|
| `notificationId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The notification ID. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | This builder. |

### setNotificationIdProvider

```
@CanIgnoreReturnValue
fun setNotificationIdProvider(
    notificationIdProvider: DefaultMediaNotificationProvider.NotificationIdProvider!
): DefaultMediaNotificationProvider.Builder!
```

Sets the provider for the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaNotification#notificationId()` used for the created notifications. By default, this is set to a provider that always returns `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider#DEFAULT_NOTIFICATION_ID()`.

Overwrites anything set in `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder#setNotificationId(int)`.

| Parameters |
|---|---|
| `notificationIdProvider: https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.NotificationIdProvider!` | The notification ID provider. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/session/DefaultMediaNotificationProvider.Builder!` | This builder. |