MediaSession.CommandButton

Added in 1.0.0
Deprecated in 1.3.0

public final class MediaSession.CommandButton implements VersionedParcelable


Button for a SessionCommand that will be shown by the controller.

It's up to the controller's decision to respect or ignore this customization request.

Summary

Nested types

This class is deprecated.

androidx.media2 is deprecated.

Public methods

@Nullable SessionCommand

Gets the command associated with this button.

@Nullable CharSequence

Gets the display name of the button.

@Nullable Bundle

Gets extra information of the button.

int

Gets the resource id of the button in this package.

boolean

Returns whether it's enabled.

Public methods

getCommand

Added in 1.0.0
Deprecated in 1.3.0
public @Nullable SessionCommand getCommand()

Gets the command associated with this button. Can be null if the button isn't enabled and only providing placeholder.

Returns
@Nullable SessionCommand

command or null

getDisplayName

Added in 1.0.0
Deprecated in 1.3.0
public @Nullable CharSequence getDisplayName()

Gets the display name of the button. Can be null or empty if the command is predefined and custom name isn't needed.

Returns
@Nullable CharSequence

custom display name. Can be null or empty.

getExtras

Added in 1.0.0
Deprecated in 1.3.0
public @Nullable Bundle getExtras()

Gets extra information of the button. It's private information between session and controller.

Returns
@Nullable Bundle

getIconResId

Added in 1.0.0
Deprecated in 1.3.0
public int getIconResId()

Gets the resource id of the button in this package. Can be 0 if the command is predefined and custom icon isn't needed.

Returns
int

resource id of the icon. Can be 0.

isEnabled

Added in 1.0.0
Deprecated in 1.3.0
public boolean isEnabled()

Returns whether it's enabled.

Returns
boolean

true if enabled. false otherwise.