SessionCommand
public final class SessionCommand
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 |
|---|
@DocumentedCommand codes of session commands. |
Constants |
|
|---|---|
static final int |
Command code for the custom command which can be defined by string action in the |
static final int |
Command code for |
static final int |
COMMAND_CODE_LIBRARY_GET_ITEM = 50004Command code for |
static final int |
Command code for |
static final int |
Command code for |
static final int |
COMMAND_CODE_LIBRARY_SEARCH = 50005Command code for |
static final int |
COMMAND_CODE_LIBRARY_SUBSCRIBE = 50001Command code for |
static final int |
COMMAND_CODE_LIBRARY_UNSUBSCRIBE = 50002Command code for |
static final int |
COMMAND_CODE_SESSION_SET_RATING = 40010Command code for |
Public fields |
|
|---|---|
final int |
The command code of a predefined command. |
final String |
The action of a custom command. |
final Bundle |
The extra bundle of a custom command. |
Public constructors |
|---|
SessionCommand(@SessionCommand.CommandCode int commandCode)Creates a predefined command. |
SessionCommand(String action, Bundle extras)Creates a custom command. |
Public methods |
|
|---|---|
boolean |
Checks the given session command for equality while ignoring extras. |
static SessionCommand |
@UnstableApiRestores a |
int |
hashCode() |
Bundle |
Constants
COMMAND_CODE_CUSTOM
public static final int COMMAND_CODE_CUSTOM = 0
Command code for the custom command which can be defined by string action in the SessionCommand.
COMMAND_CODE_LIBRARY_GET_CHILDREN
public static final int COMMAND_CODE_LIBRARY_GET_CHILDREN = 50003
Command code for getChildren.
COMMAND_CODE_LIBRARY_GET_ITEM
public static final int COMMAND_CODE_LIBRARY_GET_ITEM = 50004
Command code for getItem.
COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT
public static final int COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT = 50000
Command code for getLibraryRoot.
COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT
public static final int COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT = 50006
Command code for getSearchResult.
COMMAND_CODE_LIBRARY_SEARCH
public static final int COMMAND_CODE_LIBRARY_SEARCH = 50005
Command code for search.
COMMAND_CODE_LIBRARY_SUBSCRIBE
public static final int COMMAND_CODE_LIBRARY_SUBSCRIBE = 50001
Command code for subscribe.
COMMAND_CODE_LIBRARY_UNSUBSCRIBE
public static final int COMMAND_CODE_LIBRARY_UNSUBSCRIBE = 50002
Command code for unsubscribe.
COMMAND_CODE_SESSION_SET_RATING
public static final int COMMAND_CODE_SESSION_SET_RATING = 40010
Command code for setRating.
Public fields
commandCode
@SessionCommand.CommandCode
public final int commandCode
The command code of a predefined command. It will be COMMAND_CODE_CUSTOM for a custom command.
customAction
public final String customAction
The action of a custom command. It will be an empty string for a predefined command.
customExtras
public final Bundle customExtras
The extra bundle of a custom command. It will be EMPTY for a predefined command.
Public constructors
SessionCommand
public SessionCommand(@SessionCommand.CommandCode int commandCode)
Creates a predefined command.
| Parameters | |
|---|---|
@SessionCommand.CommandCode int commandCode |
A command code for a predefined command. |
Public methods
equals
public boolean equals(@Nullable Object obj)
Checks the given session command for equality while ignoring extras.
fromBundle
@UnstableApi
public static SessionCommand fromBundle(Bundle bundle)
Restores a SessionCommand from a Bundle.