public final class

DefaultMediaNotificationProvider.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.DefaultMediaNotificationProvider.Builder

Overview

A builder for DefaultMediaNotificationProvider instances.

Summary

Constructors
publicBuilder(Context context)

Creates a builder.

Methods
public DefaultMediaNotificationProviderbuild()

Builds the DefaultMediaNotificationProvider.

public DefaultMediaNotificationProvider.BuildersetChannelId(java.lang.String channelId)

Sets the ID of the on which created notifications are posted on.

public DefaultMediaNotificationProvider.BuildersetChannelName(int channelNameResourceId)

Sets the name of the on which created notifications are posted on.

public DefaultMediaNotificationProvider.BuildersetNotificationId(int notificationId)

Sets the MediaNotification.notificationId used for the created notifications.

public DefaultMediaNotificationProvider.BuildersetNotificationIdProvider(DefaultMediaNotificationProvider.NotificationIdProvider notificationIdProvider)

Sets the provider for the MediaNotification.notificationId used for the created notifications.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context)

Creates a builder.

Parameters:

context: Any .

Methods

public DefaultMediaNotificationProvider.Builder setNotificationId(int notificationId)

Sets the MediaNotification.notificationId used for the created notifications. By default, this is set to DefaultMediaNotificationProvider.DEFAULT_NOTIFICATION_ID.

Overwrites anything set in DefaultMediaNotificationProvider.Builder.

Parameters:

notificationId: The notification ID.

Returns:

This builder.

Sets the provider for the MediaNotification.notificationId used for the created notifications. By default, this is set to a provider that always returns DefaultMediaNotificationProvider.DEFAULT_NOTIFICATION_ID.

Overwrites anything set in DefaultMediaNotificationProvider.Builder.setNotificationId(int).

Parameters:

notificationIdProvider: The notification ID provider.

Returns:

This builder.

public DefaultMediaNotificationProvider.Builder setChannelId(java.lang.String channelId)

Sets the ID of the on which created notifications are posted on. By default, this is set to DefaultMediaNotificationProvider.DEFAULT_CHANNEL_ID.

Parameters:

channelId: The channel ID.

Returns:

This builder.

public DefaultMediaNotificationProvider.Builder setChannelName(int channelNameResourceId)

Sets the name of the on which created notifications are posted on. By default, this is set to DefaultMediaNotificationProvider.DEFAULT_CHANNEL_NAME_RESOURCE_ID.

Parameters:

channelNameResourceId: The string resource ID with the channel name.

Returns:

This builder.

Builds the DefaultMediaNotificationProvider. The method can be called at most once.