public interface

MediaNotification.ActionFactory

 androidx.media3.session.MediaNotification.ActionFactory

Overview

Creates and pending intents for notifications.

Summary

Fields
public static final longCOMMAND_FAST_FORWARD

The command to fast forward.

public static final longCOMMAND_PAUSE

The command to pause playback.

public static final longCOMMAND_PLAY

The command to start playback.

public static final longCOMMAND_REWIND

The command to rewind.

public static final longCOMMAND_SET_CAPTIONING_ENABLED

The command to set captioning enabled.

public static final longCOMMAND_SKIP_TO_NEXT

The command to skip to the next item in the queue.

public static final longCOMMAND_SKIP_TO_PREVIOUS

The command to skip to the previous item in the queue.

public static final longCOMMAND_STOP

The command to stop playback.

Methods
public NotificationCompat.ActioncreateCustomAction(IconCompat icon, java.lang.CharSequence title, java.lang.String customAction, Bundle extras)

Creates a for a notification with a custom action.

public NotificationCompat.ActioncreateMediaAction(IconCompat icon, java.lang.CharSequence title, long command)

Creates a for a notification.

public PendingIntentcreateMediaActionPendingIntent(long command)

Creates a PendingIntent for a media action that will be handled by the library.

Fields

public static final long COMMAND_PLAY

The command to start playback.

public static final long COMMAND_PAUSE

The command to pause playback.

public static final long COMMAND_STOP

The command to stop playback.

public static final long COMMAND_REWIND

The command to rewind.

public static final long COMMAND_FAST_FORWARD

The command to fast forward.

public static final long COMMAND_SKIP_TO_PREVIOUS

The command to skip to the previous item in the queue.

public static final long COMMAND_SKIP_TO_NEXT

The command to skip to the next item in the queue.

public static final long COMMAND_SET_CAPTIONING_ENABLED

The command to set captioning enabled.

Methods

public NotificationCompat.Action createMediaAction(IconCompat icon, java.lang.CharSequence title, long command)

Creates a for a notification. These actions will be handled by the library.

Parameters:

icon: The icon to show for this action.
title: The title of the action.
command: A command to send when users trigger this action.

public NotificationCompat.Action createCustomAction(IconCompat icon, java.lang.CharSequence title, java.lang.String customAction, Bundle extras)

Creates a for a notification with a custom action. Actions created with this method are not expected to be handled by the library and will be forwarded to the notification provider that provided them.

Parameters:

icon: The icon to show for this action.
title: The title of the action.
customAction: The custom action set.
extras: Extras to be included in the action.

See also: MediaNotification.Provider.handleCustomAction(MediaController, String, Bundle)

public PendingIntent createMediaActionPendingIntent(long command)

Creates a PendingIntent for a media action that will be handled by the library.

Parameters:

command: The intent's command.