PlayerNotificationManager.Builder
public class PlayerNotificationManager.Builder
A builder for PlayerNotificationManager instances.
Summary
Protected fields |
|
|---|---|
int |
|
final String |
|
int |
|
int |
|
final Context |
|
@Nullable PlayerNotificationManager.CustomActionReceiver |
|
int |
|
@Nullable String |
|
PlayerNotificationManager.MediaDescriptionAdapter |
|
int |
|
final int |
|
@Nullable PlayerNotificationManager.NotificationListener |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
Public constructors |
|---|
|
Creates an instance. |
This method is deprecated. Use |
Public methods |
|
|---|---|
PlayerNotificationManager |
build()Builds the |
PlayerNotificationManager.Builder |
setChannelDescriptionResourceId(int channelDescriptionResourceId)The description of the channel. |
PlayerNotificationManager.Builder |
setChannelImportance(@NotificationUtil.Importance int channelImportance)The importance of the channel. |
PlayerNotificationManager.Builder |
setChannelNameResourceId(int channelNameResourceId)The name of the channel. |
PlayerNotificationManager.Builder |
setCustomActionReceiver(The |
PlayerNotificationManager.Builder |
setFastForwardActionIconResourceId(The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
The key of the group the media notification should belong to. |
PlayerNotificationManager.Builder |
setMediaDescriptionAdapter(The |
PlayerNotificationManager.Builder |
setNextActionIconResourceId(int nextActionIconResourceId)The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
setNotificationListener(The |
PlayerNotificationManager.Builder |
setPauseActionIconResourceId(int pauseActionIconResourceId)The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
setPlayActionIconResourceId(int playActionIconResourceId)The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
setPreviousActionIconResourceId(int previousActionIconResourceId)The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
setRewindActionIconResourceId(int rewindActionIconResourceId)The resource id of the drawable to be used as the icon of action |
PlayerNotificationManager.Builder |
setSmallIconResourceId(int smallIconResourceId)The resource id of the small icon of the notification shown in the status bar. |
PlayerNotificationManager.Builder |
setStopActionIconResourceId(int stopActionIconResourceId)The resource id of the drawable to be used as the icon of action |
Protected fields
customActionReceiver
protected @Nullable PlayerNotificationManager.CustomActionReceiver customActionReceiver
mediaDescriptionAdapter
protected PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
notificationListener
protected @Nullable PlayerNotificationManager.NotificationListener notificationListener
Public constructors
Builder
public Builder(
Context context,
@IntRange(from = 1) int notificationId,
String channelId
)
Creates an instance.
| Parameters | |
|---|---|
Context context |
The |
@IntRange(from = 1) int notificationId |
The id of the notification to be posted. Must be greater than 0. |
String 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, |
Builder
publicBuilder(
Context context,
int notificationId,
String channelId,
PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
)
Public methods
setChannelDescriptionResourceId
public PlayerNotificationManager.Builder setChannelDescriptionResourceId(int channelDescriptionResourceId)
The description of the channel. Ignored if setChannelNameResourceId 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 | |
|---|---|
PlayerNotificationManager.Builder |
This builder. |
setChannelImportance
public PlayerNotificationManager.Builder setChannelImportance(@NotificationUtil.Importance int channelImportance)
The importance of the channel. Ignored if setChannelNameResourceId 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 IMPORTANCE_LOW.
| Returns | |
|---|---|
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 build is called. If the application has already created the notification channel, then this method should not be called.
The default is 0.
| Returns | |
|---|---|
PlayerNotificationManager.Builder |
This builder. |
setCustomActionReceiver
public PlayerNotificationManager.Builder setCustomActionReceiver(
PlayerNotificationManager.CustomActionReceiver customActionReceiver
)
The CustomActionReceiver to be used.
The default is null.
| Returns | |
|---|---|
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 ACTION_FAST_FORWARD.
The default is R.drawable#exo_notification_fastforward.
| Returns | |
|---|---|
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 | |
|---|---|
PlayerNotificationManager.Builder |
This builder. |
setMediaDescriptionAdapter
public PlayerNotificationManager.Builder setMediaDescriptionAdapter(
PlayerNotificationManager.MediaDescriptionAdapter mediaDescriptionAdapter
)
The MediaDescriptionAdapter to be queried for the notification contents.
The default is DefaultMediaDescriptionAdapter with no PendingIntent
| Returns | |
|---|---|
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 ACTION_NEXT.
The default is R.drawable#exo_notification_next.
| Returns | |
|---|---|
PlayerNotificationManager.Builder |
This builder. |
setNotificationListener
public PlayerNotificationManager.Builder setNotificationListener(
PlayerNotificationManager.NotificationListener notificationListener
)
The NotificationListener to be used.
The default is null.
| Returns | |
|---|---|
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 ACTION_PAUSE.
The default is R.drawable#exo_notification_pause.
| Returns | |
|---|---|
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 ACTION_PLAY.
The default is R.drawable#exo_notification_play.
| Returns | |
|---|---|
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 ACTION_PREVIOUS.
The default is R.drawable#exo_notification_previous.
| Returns | |
|---|---|
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 ACTION_REWIND.
The default is R.drawable#exo_notification_rewind.
| Returns | |
|---|---|
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 setSmallIcon.
The default is R.drawable#exo_notification_small_icon.
| Returns | |
|---|---|
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 ACTION_STOP.
The default is R.drawable#exo_notification_stop.
| Returns | |
|---|---|
PlayerNotificationManager.Builder |
This builder. |