MediaStyleNotificationHelper.DecoratedMediaCustomViewStyle


class MediaStyleNotificationHelper.DecoratedMediaCustomViewStyle : MediaStyleNotificationHelper.MediaStyle


Notification style for media custom views that are decorated by the system.

Instead of providing a media notification that is completely custom, a developer can set this style and still obtain system decorations like the notification header with the expand affordance and actions.

Use #setCustomContentView(RemoteViews), #setCustomBigContentView(RemoteViews) and #setCustomHeadsUpContentView(RemoteViews) to set the corresponding custom views to display.

To use this style with your Notification, feed it to #setStyle(androidx.core.app.NotificationCompat.Style) like so:

Notification noti = new NotificationCompat.Builder()
    .setSmallIcon(androidx.media3.R.drawable.media3_notification_small_icon)
    .setLargeIcon(albumArtBitmap))
    .setCustomContentView(contentView)
    .setStyle(new NotificationCompat.DecoratedMediaCustomViewStyle()
         .setMediaSession(mySession))
    .build();

If you are using this style, consider using the corresponding styles like TextAppearance_Compat_Notification_Media or TextAppearance_Compat_Notification_Title_Media in your custom views in order to get the correct styling on each platform version.

Summary

Public constructors

Inherited functions

From androidx.media3.session.MediaStyleNotificationHelper.MediaStyle
java-static SessionToken?
getSessionToken(notification: Notification!)

Extracts a SessionToken from the extra values in the MediaStyle notification.

MediaStyleNotificationHelper.MediaStyle!

This function is deprecated.

This method is a no-op and usages can be safely removed.

MediaStyleNotificationHelper.MediaStyle!
@CanIgnoreReturnValue
@RequiresPermission(value = "android.permission.MEDIA_CONTENT_CONTROL")
setRemotePlaybackInfo(
    deviceName: CharSequence!,
    iconResource: @DrawableRes Int,
    chipIntent: PendingIntent?
)

For media notifications associated with playback on a remote device, provide device information that will replace the default values for the output switcher chip on the media control, as well as an intent to use when the output switcher chip is tapped, on devices where this is supported.

MediaStyleNotificationHelper.MediaStyle!

Requests up to 3 actions (by index in the order of addition) to be shown in the compact notification view.

MediaStyleNotificationHelper.MediaStyle!

This function is deprecated.

This method is a no-op and usages can be safely removed.

From androidx.core.app.NotificationCompat.Style
Notification?

If this Style object has been set on a notification builder, this method will build that notification and return it.

Unit

Link this rich notification style with a notification builder.

Public constructors

DecoratedMediaCustomViewStyle

DecoratedMediaCustomViewStyle(session: MediaSession!)

Public functions

apply

fun apply(builder: NotificationBuilderWithBuilderAccessor!): Unit

Applies the compat style data to the framework Notification in a backwards compatible way. All other data should be stored within the Notification's extras.