MediaNotification


class MediaNotification

A notification for media playbacks.

Summary

Nested types

Creates actions and pending intents for notifications.

Provides media notifications to be posted as notifications that reflect the state of a MediaController and to send media commands to a .

Receives updates for a notification.

Constants

const String!
@UnstableApi
NOTIFICATION_DISMISSED_EVENT_KEY = "androidx.media3.session.NOTIFICATION_DISMISSED_EVENT_KEY"

Event key to indicate a media notification was dismissed.

Public constructors

MediaNotification(
    notificationId: @IntRange(from = 1) Int,
    notification: Notification!
)

Creates an instance.

Public properties

Notification!

The Notification.

@IntRange(from = 1) Int

The notification id.

Constants

NOTIFICATION_DISMISSED_EVENT_KEY

@UnstableApi
const val NOTIFICATION_DISMISSED_EVENT_KEY = "androidx.media3.session.NOTIFICATION_DISMISSED_EVENT_KEY": String!

Event key to indicate a media notification was dismissed.

This event key can be used as an extras key for a boolean extra on a media button pending intent, and as as custom session command action to inform the media notification controller that a notification was dismissed.

Public constructors

MediaNotification

MediaNotification(
    notificationId: @IntRange(from = 1) Int,
    notification: Notification!
)

Creates an instance.

Parameters
notificationId: @IntRange(from = 1) Int

The notification id to be used for notify.

notification: Notification!

A Notification that reflects the state of a MediaController and to send media commands to a MediaSession. The notification may be used to start a service in the foreground. It's highly recommended to use a media style notification.

Public properties

notification

val notificationNotification!

The Notification.

notificationId

val notificationId: @IntRange(from = 1) Int

The notification id.