public class

PlayerNotificationManager.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.ui.PlayerNotificationManager.Builder

Overview

A builder for PlayerNotificationManager instances.

Summary

Fields
protected intchannelDescriptionResourceId

protected final java.lang.StringchannelId

protected intchannelImportance

protected intchannelNameResourceId

protected final Contextcontext

protected PlayerNotificationManager.CustomActionReceivercustomActionReceiver

protected intfastForwardActionIconResourceId

protected java.lang.StringgroupKey

protected PlayerNotificationManager.MediaDescriptionAdaptermediaDescriptionAdapter

protected intnextActionIconResourceId

protected final intnotificationId

protected PlayerNotificationManager.NotificationListenernotificationListener

protected intpauseActionIconResourceId

protected intplayActionIconResourceId

protected intpreviousActionIconResourceId

protected intrewindActionIconResourceId

protected intsmallIconResourceId

protected intstopActionIconResourceId

Constructors
publicBuilder(Context context, int notificationId, java.lang.String channelId)

Creates an instance.

publicBuilder(Context context, int notificationId, java.lang.String channelId, PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)

Methods
public PlayerNotificationManagerbuild()

Builds the PlayerNotificationManager.

public PlayerNotificationManager.BuildersetChannelDescriptionResourceId(int channelDescriptionResourceId)

The description of the channel.

public PlayerNotificationManager.BuildersetChannelImportance(int channelImportance)

The importance of the channel.

public PlayerNotificationManager.BuildersetChannelNameResourceId(int channelNameResourceId)

The name of the channel.

public PlayerNotificationManager.BuildersetCustomActionReceiver(PlayerNotificationManager.CustomActionReceiver customActionReceiver)

The PlayerNotificationManager.CustomActionReceiver to be used.

public PlayerNotificationManager.BuildersetFastForwardActionIconResourceId(int fastForwardActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_FAST_FORWARD.

public PlayerNotificationManager.BuildersetGroup(java.lang.String groupKey)

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

public PlayerNotificationManager.BuildersetMediaDescriptionAdapter(PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)

The PlayerNotificationManager.MediaDescriptionAdapter to be queried for the notification contents.

public PlayerNotificationManager.BuildersetNextActionIconResourceId(int nextActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_NEXT.

public PlayerNotificationManager.BuildersetNotificationListener(PlayerNotificationManager.NotificationListener notificationListener)

The PlayerNotificationManager.NotificationListener to be used.

public PlayerNotificationManager.BuildersetPauseActionIconResourceId(int pauseActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PAUSE.

public PlayerNotificationManager.BuildersetPlayActionIconResourceId(int playActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PLAY.

public PlayerNotificationManager.BuildersetPreviousActionIconResourceId(int previousActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PREVIOUS.

public PlayerNotificationManager.BuildersetRewindActionIconResourceId(int rewindActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_REWIND.

public PlayerNotificationManager.BuildersetSmallIconResourceId(int smallIconResourceId)

The resource id of the small icon of the notification shown in the status bar.

public PlayerNotificationManager.BuildersetStopActionIconResourceId(int stopActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_STOP.

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

Fields

protected final Context context

protected final int notificationId

protected final java.lang.String channelId

protected PlayerNotificationManager.NotificationListener notificationListener

protected PlayerNotificationManager.CustomActionReceiver customActionReceiver

protected PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter

protected int channelNameResourceId

protected int channelDescriptionResourceId

protected int channelImportance

protected int smallIconResourceId

protected int rewindActionIconResourceId

protected int playActionIconResourceId

protected int pauseActionIconResourceId

protected int stopActionIconResourceId

protected int fastForwardActionIconResourceId

protected int previousActionIconResourceId

protected int nextActionIconResourceId

protected java.lang.String groupKey

Constructors

public Builder(Context context, int notificationId, java.lang.String channelId, PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)

Deprecated: Use PlayerNotificationManager.Builder instead, then call PlayerNotificationManager.Builder.

public Builder(Context context, int notificationId, java.lang.String channelId)

Creates an instance.

Parameters:

context: The .
notificationId: The id of the notification to be posted. Must be greater than 0.
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, PlayerNotificationManager.Builder.setChannelNameResourceId(int) needs to be called as well.

Methods

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 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:

This builder.

public PlayerNotificationManager.Builder setChannelDescriptionResourceId(int channelDescriptionResourceId)

The description of the channel. Ignored if 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:

This builder.

public PlayerNotificationManager.Builder setChannelImportance(int channelImportance)

The importance of the channel. Ignored if 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 NotificationUtil.IMPORTANCE_LOW.

Returns:

This builder.

public PlayerNotificationManager.Builder setNotificationListener(PlayerNotificationManager.NotificationListener notificationListener)

The PlayerNotificationManager.NotificationListener to be used.

The default is null.

Returns:

This builder.

public PlayerNotificationManager.Builder setCustomActionReceiver(PlayerNotificationManager.CustomActionReceiver customActionReceiver)

The PlayerNotificationManager.CustomActionReceiver to be used.

The default is null.

Returns:

This builder.

public PlayerNotificationManager.Builder setSmallIconResourceId(int smallIconResourceId)

The resource id of the small icon of the notification shown in the status bar. See .

The default is R.drawable#exo_notification_small_icon.

Returns:

This builder.

public PlayerNotificationManager.Builder setPlayActionIconResourceId(int playActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PLAY.

The default is R.drawable#exo_notification_play.

Returns:

This builder.

public PlayerNotificationManager.Builder setPauseActionIconResourceId(int pauseActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PAUSE.

The default is R.drawable#exo_notification_pause.

Returns:

This builder.

public PlayerNotificationManager.Builder setStopActionIconResourceId(int stopActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_STOP.

The default is R.drawable#exo_notification_stop.

Returns:

This builder.

public PlayerNotificationManager.Builder setRewindActionIconResourceId(int rewindActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_REWIND.

The default is R.drawable#exo_notification_rewind.

Returns:

This builder.

public PlayerNotificationManager.Builder setFastForwardActionIconResourceId(int fastForwardActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_FAST_FORWARD.

The default is R.drawable#exo_notification_fastforward.

Returns:

This builder.

public PlayerNotificationManager.Builder setPreviousActionIconResourceId(int previousActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_PREVIOUS.

The default is R.drawable#exo_notification_previous.

Returns:

This builder.

public PlayerNotificationManager.Builder setNextActionIconResourceId(int nextActionIconResourceId)

The resource id of the drawable to be used as the icon of action PlayerNotificationManager.ACTION_NEXT.

The default is R.drawable#exo_notification_next.

Returns:

This builder.

public PlayerNotificationManager.Builder setGroup(java.lang.String groupKey)

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

The default is null

Returns:

This builder.

public PlayerNotificationManager.Builder setMediaDescriptionAdapter(PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter)

The PlayerNotificationManager.MediaDescriptionAdapter to be queried for the notification contents.

The default is DefaultMediaDescriptionAdapter with no PendingIntent

Returns:

This builder.

Builds the PlayerNotificationManager.