PlayerNotificationManager.Builder


class PlayerNotificationManager.Builder


A builder for PlayerNotificationManager instances.

Summary

Public constructors

Builder(
    context: Context!,
    notificationId: @IntRange(from = 1) Int,
    channelId: String!
)

Creates an instance.

Builder(
    context: Context!,
    notificationId: Int,
    channelId: String!,
    mediaDescriptionAdapter: PlayerNotificationManager.MediaDescriptionAdapter!
)

This function is deprecated.

Use Builder instead, then call setMediaDescriptionAdapter.

Public functions

PlayerNotificationManager!

Builds the PlayerNotificationManager.

PlayerNotificationManager.Builder!
setChannelDescriptionResourceId(channelDescriptionResourceId: Int)

The description of the channel.

PlayerNotificationManager.Builder!

The importance of the channel.

PlayerNotificationManager.Builder!
setChannelNameResourceId(channelNameResourceId: Int)

The name of the channel.

PlayerNotificationManager.Builder!

The CustomActionReceiver to be used.

PlayerNotificationManager.Builder!
setFastForwardActionIconResourceId(
    fastForwardActionIconResourceId: Int
)

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

PlayerNotificationManager.Builder!
setGroup(groupKey: String!)

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

PlayerNotificationManager.Builder!

The MediaDescriptionAdapter to be queried for the notification contents.

PlayerNotificationManager.Builder!
setNextActionIconResourceId(nextActionIconResourceId: Int)

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

PlayerNotificationManager.Builder!

The NotificationListener to be used.

PlayerNotificationManager.Builder!
setPauseActionIconResourceId(pauseActionIconResourceId: Int)

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

PlayerNotificationManager.Builder!
setPlayActionIconResourceId(playActionIconResourceId: Int)

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

PlayerNotificationManager.Builder!
setPreviousActionIconResourceId(previousActionIconResourceId: Int)

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

PlayerNotificationManager.Builder!
setRewindActionIconResourceId(rewindActionIconResourceId: Int)

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

PlayerNotificationManager.Builder!
setSmallIconResourceId(smallIconResourceId: Int)

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

PlayerNotificationManager.Builder!
setStopActionIconResourceId(stopActionIconResourceId: Int)

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

Public constructors

Builder

Builder(
    context: Context!,
    notificationId: @IntRange(from = 1) Int,
    channelId: String!
)

Creates an instance.

Parameters
context: Context!

The Context.

notificationId: @IntRange(from = 1) Int

The id of the notification to be posted. Must be greater than 0.

channelId: String!

The id of the notification channel of an existing notification channel or of the channel that should be automatically created. In the latter case, setChannelNameResourceId needs to be called as well.

Builder

Builder(
    context: Context!,
    notificationId: Int,
    channelId: String!,
    mediaDescriptionAdapter: PlayerNotificationManager.MediaDescriptionAdapter!
)

Public functions

setChannelDescriptionResourceId

fun setChannelDescriptionResourceId(channelDescriptionResourceId: Int): PlayerNotificationManager.Builder!

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

fun setChannelImportance(@NotificationUtil.Importance channelImportance: Int): PlayerNotificationManager.Builder!

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

fun setChannelNameResourceId(channelNameResourceId: Int): PlayerNotificationManager.Builder!

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

fun setCustomActionReceiver(
    customActionReceiver: PlayerNotificationManager.CustomActionReceiver!
): PlayerNotificationManager.Builder!

The CustomActionReceiver to be used.

The default is null.

Returns
PlayerNotificationManager.Builder!

This builder.

setFastForwardActionIconResourceId

fun setFastForwardActionIconResourceId(
    fastForwardActionIconResourceId: Int
): PlayerNotificationManager.Builder!

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

fun setGroup(groupKey: String!): PlayerNotificationManager.Builder!

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

The default is null

Returns
PlayerNotificationManager.Builder!

This builder.

setMediaDescriptionAdapter

fun setMediaDescriptionAdapter(
    mediaDescriptionAdapter: PlayerNotificationManager.MediaDescriptionAdapter!
): PlayerNotificationManager.Builder!

The MediaDescriptionAdapter to be queried for the notification contents.

The default is DefaultMediaDescriptionAdapter with no PendingIntent

Returns
PlayerNotificationManager.Builder!

This builder.

setNextActionIconResourceId

fun setNextActionIconResourceId(nextActionIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setNotificationListener(
    notificationListener: PlayerNotificationManager.NotificationListener!
): PlayerNotificationManager.Builder!

The NotificationListener to be used.

The default is null.

Returns
PlayerNotificationManager.Builder!

This builder.

setPauseActionIconResourceId

fun setPauseActionIconResourceId(pauseActionIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setPlayActionIconResourceId(playActionIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setPreviousActionIconResourceId(previousActionIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setRewindActionIconResourceId(rewindActionIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setSmallIconResourceId(smallIconResourceId: Int): PlayerNotificationManager.Builder!

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

fun setStopActionIconResourceId(stopActionIconResourceId: Int): PlayerNotificationManager.Builder!

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.

Protected properties

channelDescriptionResourceId

protected val channelDescriptionResourceIdInt

channelId

protected val channelIdString!

channelImportance

protected val channelImportanceInt

channelNameResourceId

protected val channelNameResourceIdInt

context

protected val contextContext!

fastForwardActionIconResourceId

protected val fastForwardActionIconResourceIdInt

groupKey

protected val groupKeyString?

nextActionIconResourceId

protected val nextActionIconResourceIdInt

notificationId

protected val notificationIdInt

pauseActionIconResourceId

protected val pauseActionIconResourceIdInt

playActionIconResourceId

protected val playActionIconResourceIdInt

previousActionIconResourceId

protected val previousActionIconResourceIdInt

rewindActionIconResourceId

protected val rewindActionIconResourceIdInt

smallIconResourceId

protected val smallIconResourceIdInt

stopActionIconResourceId

protected val stopActionIconResourceIdInt