MediaNotification.Provider
@UnstableApi
interface MediaNotification.Provider
Provides media notifications to be posted as notifications that reflect the state of a MediaController and to send media commands to a MediaSession.
The provider is required to create a notification channel, which is required to show notification for SDK_INT >= 26.
All methods will be called on the application thread of the Player associated with the MediaSession the notification is provided for.
Summary
Nested types |
|---|
interface MediaNotification.Provider.CallbackReceives updates for a notification. |
Public functions |
|
|---|---|
MediaNotification! |
createNotification(Creates a new |
Boolean |
handleCustomCommand(session: MediaSession!, action: String!, extras: Bundle!)Handles a notification's custom command. |
Public functions
createNotification
fun createNotification(
mediaSession: MediaSession!,
mediaButtonPreferences: ImmutableList<CommandButton!>!,
actionFactory: MediaNotification.ActionFactory!,
onNotificationChangedCallback: MediaNotification.Provider.Callback!
): MediaNotification!
Creates a new MediaNotification.
| Parameters | |
|---|---|
mediaSession: MediaSession! |
The media session. |
mediaButtonPreferences: ImmutableList<CommandButton!>! |
The media button preferences set by the session. |
actionFactory: MediaNotification.ActionFactory! |
The |
onNotificationChangedCallback: MediaNotification.Provider.Callback! |
A callback that the provider needs to notify when the notification has changed and needs to be posted again, for example after a bitmap has been loaded asynchronously. |
handleCustomCommand
fun handleCustomCommand(session: MediaSession!, action: String!, extras: Bundle!): Boolean
Handles a notification's custom command.
| Parameters | |
|---|---|
session: MediaSession! |
The media session. |
action: String! |
The custom command action. |
extras: Bundle! |
A bundle |
| Returns | |
|---|---|
Boolean |
|
| See also | |
|---|---|
createCustomAction |