SessionCommand


class SessionCommand : Bundleable


A command that a MediaController can send to a MediaSession.

If commandCode isn't COMMAND_CODE_CUSTOM, it's a predefined command. If commandCode is COMMAND_CODE_CUSTOM, it's a custom command and customAction must not be null.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation SessionCommand.CommandCode

Command codes of session commands.

Constants

const Int

Command code for the custom command which can be defined by string action in the .

const Int

Command code for getChildren.

const Int

Command code for getItem.

const Int

Command code for getLibraryRoot.

const Int

Command code for getSearchResult.

const Int

Command code for search.

const Int

Command code for subscribe.

const Int

Command code for unsubscribe.

const Int

Command code for setRating.

const Bundleable.Creator<SessionCommand!>!

This property is deprecated.

Use fromBundle instead.

Public constructors

Creates a predefined command.

SessionCommand(action: String!, extras: Bundle!)

Creates a custom command.

Public functions

Boolean
equals(obj: Any?)

Checks the given session command for equality while ignoring extras.

java-static SessionCommand!

Restores a SessionCommand from a Bundle.

Int
Bundle!

Returns a Bundle representing the information stored in this object.

Public properties

Int

The command code of a predefined command.

String!

The action of a custom command.

Bundle!

The extra bundle of a custom command.

Constants

COMMAND_CODE_CUSTOM

const val COMMAND_CODE_CUSTOM = 0: Int

Command code for the custom command which can be defined by string action in the .

COMMAND_CODE_LIBRARY_GET_CHILDREN

const val COMMAND_CODE_LIBRARY_GET_CHILDREN = 50003: Int

Command code for getChildren.

COMMAND_CODE_LIBRARY_GET_ITEM

const val COMMAND_CODE_LIBRARY_GET_ITEM = 50004: Int

Command code for getItem.

COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT

const val COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT = 50000: Int

Command code for getLibraryRoot.

COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT

const val COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT = 50006: Int

Command code for getSearchResult.

COMMAND_CODE_LIBRARY_SEARCH

const val COMMAND_CODE_LIBRARY_SEARCH = 50005: Int

Command code for search.

COMMAND_CODE_LIBRARY_SUBSCRIBE

const val COMMAND_CODE_LIBRARY_SUBSCRIBE = 50001: Int

Command code for subscribe.

COMMAND_CODE_LIBRARY_UNSUBSCRIBE

const val COMMAND_CODE_LIBRARY_UNSUBSCRIBE = 50002: Int

Command code for unsubscribe.

COMMAND_CODE_SESSION_SET_RATING

const val COMMAND_CODE_SESSION_SET_RATING = 40010: Int

Command code for setRating.

CREATOR

@UnstableApi
const val CREATORBundleable.Creator<SessionCommand!>!

Object that can restore a SessionCommand from a Bundle.

Public constructors

SessionCommand

SessionCommand(@SessionCommand.CommandCode commandCode: Int)

Creates a predefined command.

Parameters
@SessionCommand.CommandCode commandCode: Int

A command code for a predefined command.

SessionCommand

SessionCommand(action: String!, extras: Bundle!)

Creates a custom command.

Parameters
action: String!

The action of this custom command.

extras: Bundle!

An extra bundle for this custom command. This value is not used when the command is sent to a legacy android.support.v4.media.session.MediaSessionCompat or .

Public functions

equals

fun equals(obj: Any?): Boolean

Checks the given session command for equality while ignoring extras.

fromBundle

@UnstableApi
java-static fun fromBundle(bundle: Bundle!): SessionCommand!

Restores a SessionCommand from a Bundle.

hashCode

fun hashCode(): Int

toBundle

@UnstableApi
fun toBundle(): Bundle!

Returns a Bundle representing the information stored in this object.

Public properties

commandCode

@SessionCommand.CommandCode
val commandCodeInt

The command code of a predefined command. It will be COMMAND_CODE_CUSTOM for a custom command.

customAction

val customActionString!

The action of a custom command. It will be an empty string for a predefined command.

customExtras

val customExtrasBundle!

The extra bundle of a custom command. It will be EMPTY for a predefined command.

Interoperability: This value is not used when the command is sent to a legacy or .