open class MediaStyle : NotificationCompat.Style
Notification style for media playback notifications. In the expanded form, up to 5
actions specified with
#addAction(int, CharSequence, PendingIntent) addAction will be shown as icon-only pushbuttons, suitable for transport controls. The Bitmap given to
#setLargeIcon(android.graphics.Bitmap) setLargeIcon() will be treated as album artwork. Unlike the other styles provided here, MediaStyle can also modify the standard-size content view; by providing action indices to
setShowActionsInCompactView(int...) you can promote up to 3 actions to be displayed in the standard view alongside the usual content. Notifications created with MediaStyle will have their category set to
CATEGORY_TRANSPORT unless you set a different category using
setCategory(). Finally, if you attach a
NotificationCompat.MediaStyle#setMediaSession, the System UI can identify this as a notification representing an active media session and respond accordingly (by showing album artwork in the lockscreen, for example). To use this style with your Notification, feed it to
androidx.core.app.NotificationCompat.Builder#setStyle like so:
Notification noti = new NotificationCompat.Builder()
.setContentText("Artist - Album")
If this Style object has been set on a notification builder, this method will build that notification and return it. Otherwise, it will return
setBuilder(@Nullable builder: NotificationCompat.Builder?)
Link this rich notification style with a notification builder.
open fun setCancelButtonIntent(pendingIntent: PendingIntent!): NotificationCompat.MediaStyle!
Sets the pending intent to be sent when the cancel button is pressed. See
|PendingIntent!: the intent to be sent when the cancel button is pressed
open fun setShowActionsInCompactView(vararg actions: Int): NotificationCompat.MediaStyle!
Requests up to 3 actions (by index in the order of addition) to be shown in the compact notification view.
|Int: the indices of the actions to show in the compact notification view
open fun setShowCancelButton(