CastMediaControlIntent | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Methods | Inherited Methods | [Expand All]
public final class

# CastMediaControlIntent

extends Object

java.lang.Object
↳ | com.google.android.gms.cast.CastMediaControlIntent

## Class Overview

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.

## Summary

Constants
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 | CATEGORY_CAST | This constant is deprecated. use `categoryForCast(String)` instead.
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 Methods
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 | 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(Collection<String> namespaces) Returns a custom control category for discovering Cast devices currently running an application which supports the specified namespaces.
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 | languageTagForLocale(Locale locale) Returns an RFC-5646 language tag string fo the given locale.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## 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.

Constant Value: "com.google.android.gms.cast.ACTION_SYNC_STATUS"

#### public static final String CATEGORY_CAST

This constant is deprecated.
use `categoryForCast(String)` instead.

A control category for discovering Cast devices. When used as-is, matches any Cast device, independent of app or namespace support. For restricting Cast devices by app and/or namespaces support, use `categoryForCast(String)`.

Constant Value: "com.google.android.gms.cast.CATEGORY_CAST"

#### public static final String DEFAULT_MEDIA_RECEIVER_APPLICATION_ID

The application ID for the Cast Default Media Receiver.

Constant Value: "CC1AD845"

#### public static final int ERROR_CODE_REQUEST_FAILED

An error code indicating that a Cast request has failed.

Constant Value: 1 (0x00000001)

#### 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.

Constant Value: 2 (0x00000002)

#### 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.

Constant Value: 3 (0x00000003)

#### 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.

Constant Value: "com.google.android.gms.cast.EXTRA_CAST_APPLICATION_ID"

#### 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)`.

Constant Value: "com.google.android.gms.cast.EXTRA_CAST_LANGUAGE_CODE"

#### 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.

Constant Value: "com.google.android.gms.cast.EXTRA_CAST_RELAUNCH_APPLICATION"

#### 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.

Constant Value: "com.google.android.gms.cast.EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS"

#### public static final String EXTRA_CUSTOM_DATA

The extra that contains a compact JSON string of custom data to pass with a media request.

Constant Value: "com.google.android.gms.cast.EXTRA_CUSTOM_DATA"

#### 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.

Constant Value: "com.google.android.gms.cast.EXTRA_DEBUG_LOGGING_ENABLED"

#### 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.

Constant Value: "com.google.android.gms.cast.EXTRA_ERROR_CODE"

## Public Methods

#### 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 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 (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 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.

#### public static String languageTagForLocale (Locale locale)

Returns an RFC-5646 language tag string fo the given locale.