Intent constants for use with the Cast MediaRouteProvider. This class also contains utility methods for creating a control category for discovering Cast media routes that support a specific app and/or set of namespaces, to be used with MediaRouteSelector.
Constant Summary
String | ACTION_SYNC_STATUS | A Cast extension action for requesting the current media status when the current item ID is not known to the client application. |
String | DEFAULT_MEDIA_RECEIVER_APPLICATION_ID | The application ID for the Cast Default Media Receiver. |
int | ERROR_CODE_REQUEST_FAILED | An error code indicating that a Cast request has failed. |
int | ERROR_CODE_SESSION_START_FAILED | An error code indicating that the request could not be processed because the session could not be started. |
int | ERROR_CODE_TEMPORARILY_DISCONNECTED | An error code indicating that the connection to the Cast device has been lost, but the system is actively trying to re-establish the connection. |
String | EXTRA_CAST_APPLICATION_ID | The extra that contains the ID of the
application to launch for an
ACTION_START_SESSION request. |
String | EXTRA_CAST_LANGUAGE_CODE | The extra that indicates the language to be used by the receiver application. |
String | EXTRA_CAST_RELAUNCH_APPLICATION | The extra that indicates whether the application should be relaunched if it is already running (the default behavior) or whether an attempt should be made to join the application first. |
String | EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS | The extra that indicates that the receiver application should be stopped when the session ends. |
String | EXTRA_CUSTOM_DATA | The extra that contains a compact JSON string of custom data to pass with a media request. |
String | EXTRA_DEBUG_LOGGING_ENABLED | The extra that indicates whether debug logging should be enabled for the Cast session. |
String | EXTRA_ERROR_CODE | An error bundle extra for the error code. |
Public Method Summary
static String |
categoryForCast(Collection<String>
namespaces)
Returns a custom control category for discovering Cast devices currently
running an application which supports the specified namespaces.
|
static String |
categoryForCast(String
applicationId, Collection<String>
namespaces)
Returns a custom control category for discovering Cast devices meeting
both application ID and namespace restrictions.
|
static String |
categoryForCast(String
applicationId)
Returns a custom control category for discovering Cast devices that support
running the specified app, independent of whether the app is running or not.
|
static String |
categoryForRemotePlayback(String
applicationId)
Returns a custom control category for discovering Cast devices which support
the default Android remote playback actions using the specified Cast player.
|
static String |
categoryForRemotePlayback()
Returns a custom control category for discovering Cast devices which support
the Default Media Receiver.
|
static String |
Inherited Method Summary
Constants
public static final String ACTION_SYNC_STATUS
A Cast extension action for requesting the current media status when the current item ID is not known to the client application.
The extra
EXTRA_SESSION_ID
must be supplied in the request. The request will fail with
an error if the current session does not match this session ID, or if there is no
current session.
The extra
EXTRA_ITEM_STATUS_UPDATE_RECEIVER
may optionally be supplied in the request
to attach an update receiver for the current media item, if there is any.
If any media is currently loaded, the result intent will contain the extras
EXTRA_ITEM_ID
,
EXTRA_ITEM_STATUS
, and
EXTRA_ITEM_METADATA
. Otherwise, the result intent will be empty.
public static final String DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
The application ID for the Cast Default Media Receiver.
public static final int ERROR_CODE_REQUEST_FAILED
An error code indicating that a Cast request has failed.
public static final int ERROR_CODE_SESSION_START_FAILED
An error code indicating that the request could not be processed because the session could not be started.
public static final int ERROR_CODE_TEMPORARILY_DISCONNECTED
An error code indicating that the connection to the Cast device has been lost, but the system is actively trying to re-establish the connection.
public static final String EXTRA_CAST_APPLICATION_ID
The extra that contains the ID of the application to launch for an
ACTION_START_SESSION
request. The value is expected to be a String.
public static final String EXTRA_CAST_LANGUAGE_CODE
The extra that indicates the language to be used by the receiver application. May be
included in an
ACTION_START_SESSION
request. The value is expected to be a language tag in
RFC-5646 format; a tag can be constructed from an Locale
object
using
languageTagForLocale(Locale)
.
public static final String EXTRA_CAST_RELAUNCH_APPLICATION
The extra that indicates whether the application should be relaunched if it is
already running (the default behavior) or whether an attempt should be made to join the
application first. May be included in an
ACTION_START_SESSION
request. The value is expected to be a boolean.
public static final String EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS
The extra that indicates that the receiver application should be stopped when the
session ends. May be included in an
ACTION_START_SESSION
request. The value is expected to be a boolean.
public static final String EXTRA_CUSTOM_DATA
The extra that contains a compact JSON string of custom data to pass with a media request.
public static final String EXTRA_DEBUG_LOGGING_ENABLED
The extra that indicates whether debug logging should be enabled for the Cast session. The value is expected to be a boolean.
public static final String EXTRA_ERROR_CODE
An error bundle extra for the error code. The value is an integer, and will be one
of the ERROR_CODE_*
constants declared in this class.
Public Methods
public static String categoryForCast (Collection<String> namespaces)
Returns a custom control category for discovering Cast devices currently running an application which supports the specified namespaces. Apps supporting additional namespaces beyond those specified here are still considered supported.
Throws
IllegalArgumentException | If namespaces is null . |
---|
public static String categoryForCast (String applicationId, Collection<String> namespaces)
Returns a custom control category for discovering Cast devices meeting both
application ID and namespace restrictions. See
categoryForCast(Collection)
and
categoryForCast(String)
for more details.
Throws
IllegalArgumentException | If either of the parameters is null . |
---|
public static String categoryForCast (String applicationId)
Returns a custom control category for discovering Cast devices that support running the specified app, independent of whether the app is running or not.
Parameters
applicationId | The application ID of the receiver application. |
---|
Throws
IllegalArgumentException | If applicationId is null . |
---|
public static String categoryForRemotePlayback (String applicationId)
Returns a custom control category for discovering Cast devices which support the
default Android remote playback actions using the specified Cast player. If the Default
Media Receiver is desired, use
DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
as the applicationId
.
Parameters
applicationId | The application ID of the receiver application. |
---|
Throws
IllegalArgumentException | If applicationId is null . |
---|
public static String categoryForRemotePlayback ()
Returns a custom control category for discovering Cast devices which support the Default Media Receiver.