Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

MediaNotification

open class MediaNotification
kotlin.Any
   ↳ androidx.media2.session.MediaSessionService.MediaNotification

Returned by onUpdateNotification(MediaSession) for making session service foreground service to keep playback running in the background. It's highly recommended to show media style notification here.

Summary

Public constructors

<init>(notificationId: Int, @NonNull notification: Notification)

Default constructor

Public methods

open Notification

Gets the notification.

open Int

Gets the id of the id.

Public constructors

<init>

MediaNotification(notificationId: Int, @NonNull notification: Notification)

Default constructor

Parameters
notificationId Int: notification id to be used for NotificationManager#notify(int, Notification).
notification Int: a notification to make session service foreground service. Media style notification is recommended here.

Public methods

getNotification

@NonNull open fun getNotification(): Notification

Gets the notification.

Return
Notification: the notification

getNotificationId

open fun getNotificationId(): Int

Gets the id of the id.

Return
Int: the notification id