public class

MediaStyleNotificationHelper.DecoratedMediaCustomViewStyle

extends MediaStyleNotificationHelper.MediaStyle

 java.lang.Object

androidx.core.app.NotificationCompat.Style

androidx.media3.session.MediaStyleNotificationHelper.MediaStyle

↳androidx.media3.session.MediaStyleNotificationHelper.DecoratedMediaCustomViewStyle

Overview

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 or in your custom views in order to get the correct styling on each platform version.

Summary

Fields
from NotificationCompat.StylemBuilder
Constructors
publicDecoratedMediaCustomViewStyle(MediaSession session)

Methods
public voidapply(NotificationBuilderWithBuilderAccessor builder)

Applies the compat style data to the framework Notification in a backwards compatible way.

public RemoteViewsmakeBigContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViewsmakeContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViewsmakeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder)

from MediaStyleNotificationHelper.MediaStylegetSessionToken, setCancelButtonIntent, setRemotePlaybackInfo, setShowActionsInCompactView, setShowCancelButton
from NotificationCompat.StyleaddCompatExtras, applyStandardTemplate, build, buildIntoRemoteViews, clearCompatExtraKeys, createColoredBitmap, displayCustomViewInline, extractStyleFromNotification, getClassName, restoreFromCompatExtras, setBuilder
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public DecoratedMediaCustomViewStyle(MediaSession session)

Methods

public void apply(NotificationBuilderWithBuilderAccessor builder)

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.

public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder)

public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder)