MediaSession.CommandButton

Added in 1.0.0
Deprecated in 1.3.0

class MediaSession.CommandButton : 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 functions

SessionCommand?

Gets the command associated with this button.

CharSequence?

Gets the display name of the button.

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 functions

getCommand

Added in 1.0.0
Deprecated in 1.3.0
fun getCommand(): SessionCommand?

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

Returns
SessionCommand?

command or null

getDisplayName

Added in 1.0.0
Deprecated in 1.3.0
fun getDisplayName(): CharSequence?

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

Returns
CharSequence?

custom display name. Can be null or empty.

getExtras

Added in 1.0.0
Deprecated in 1.3.0
fun getExtras(): Bundle?

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

Returns
Bundle?

getIconResId

Added in 1.0.0
Deprecated in 1.3.0
fun getIconResId(): Int

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
fun isEnabled(): Boolean

Returns whether it's enabled.

Returns
Boolean

true if enabled. false otherwise.