com.google.android.gms.cast.Cast.CastApi |
This interface is deprecated.
This class is deprecated. See Migrate Android Sender
App from Cast SDK v2 to v3.
The main entry point for interacting with a Google Cast device.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the device's active-input state.
| |||||||||||
Returns the metadata for the currently running receiver application, if any.
| |||||||||||
Returns the current receiver application status, if any.
| |||||||||||
Returns the device's standby state.
| |||||||||||
Returns the device's volume, in the range [0.0, 1.0].
| |||||||||||
Returns the device's mute state.
| |||||||||||
Joins (connects to) the currently running application on the receiver.
| |||||||||||
Joins (connects to) the currently running application on the receiver.
| |||||||||||
Joins (connects to) an application on the receiver.
| |||||||||||
This method is deprecated.
Use
launchApplication(GoogleApiClient, String, LaunchOptions) .
| |||||||||||
Launches an application on the receiver.
| |||||||||||
Launches an application on the receiver.
| |||||||||||
Leaves (disconnects from) the receiver application.
| |||||||||||
Removes a
Cast.MessageReceivedCallback from this controller for a given namespace. | |||||||||||
Requests the receiver's current status.
| |||||||||||
Sends a message to the currently connected application.
| |||||||||||
Sets a new
Cast.MessageReceivedCallback listener on this controller for a given namespace. | |||||||||||
Mutes or unmutes the device's audio.
| |||||||||||
Sets the device volume.
| |||||||||||
Stops the currently running receiver application, optionally doing so only if its session ID
matches the supplied one.
| |||||||||||
Stops any running receiver application(s).
|
Returns the device's active-input state.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
int |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Returns the metadata for the currently running receiver application, if any.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
ApplicationMetadata |
The application metadata, or null if no application is currently running on
the receiver. |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Returns the current receiver application status, if any. Message text is localized to the Google Cast device's locale.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
String |
The application status text, or null if no application is currently running
on the receiver or if the receiver application has not provided any status text. |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Returns the device's standby state. The returned value is STANDBY_STATE_UNKNOWN
,
STANDBY_STATE_NO
, or STANDBY_STATE_YES
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
int |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Returns the device's volume, in the range [0.0, 1.0].
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
double |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Returns the device's mute state.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
boolean |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
Joins (connects to) the currently running application on the receiver. The previous PendingResult
will be canceled with the Cast.ApplicationConnectionResult
's status code
being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information.
|
Joins (connects to) the currently running application on the receiver. The previous PendingResult
will be canceled with the Cast.ApplicationConnectionResult
's status code
being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
applicationId |
String : The ID of the receiver application to connect to, or null to
connect to the currently running application. |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information.
|
Joins (connects to) an application on the receiver. The previous PendingResult
will
be canceled with the Cast.ApplicationConnectionResult
's status code being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
applicationId |
String : The ID of the receiver application to connect to, or null to
connect to the currently running application. |
sessionId |
String : The expected session ID of the receiver application, or null to
connect without checking for a matching session ID. |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information.
|
This method is deprecated.
Use launchApplication(GoogleApiClient, String, LaunchOptions)
.
Launches an application on the receiver. The previous PendingResult
will be canceled
with the Cast.ApplicationConnectionResult
's status code being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
applicationId |
String : The ID of the receiver application to launch. |
relaunchIfRunning |
boolean : If true , relaunches the application if it is already
running. |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information. |
Launches an application on the receiver. If the application is already running, it is joined
(not relaunched). The previous PendingResult
will be canceled with the Cast.ApplicationConnectionResult
's status code being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
applicationId |
String : The ID of the receiver application to launch. |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information.
|
Launches an application on the receiver. The previous PendingResult
will be canceled
with the Cast.ApplicationConnectionResult
's status code being CANCELED
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
applicationId |
String : The ID of the receiver application to launch. |
launchOptions |
LaunchOptions : The launch options for the request. |
Returns | |
---|---|
PendingResult<Cast.ApplicationConnectionResult> |
A PendingResult which can be used to retrieve connection information.
|
Leaves (disconnects from) the receiver application. If there is no currently active
application session, this method does nothing. If this method is called while stopApplication(GoogleApiClient)
is pending, then this method does nothing. The Status
's status code
will be INVALID_REQUEST
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
PendingResult<Status> |
A PendingResult which can be used to retrieve if the command was successful.
|
Removes a Cast.MessageReceivedCallback
from this controller for a given namespace.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
namespace |
String : The namespace of the Cast channel. Namespaces must begin with the prefix "
urn:x-cast: ". |
Throws | |
---|---|
IOException |
If an I/O error occurs while performing the request. |
IllegalArgumentException |
If namespace is null or empty.
|
Requests the receiver's current status.
Parameters | |
---|---|
client |
GoogleApiClient |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
IOException |
If an I/O error occurs while performing the request. |
Sends a message to the currently connected application.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
namespace |
String : The namespace for the message. Namespaces must begin with the prefix "
urn:x-cast: ". |
message |
String : The message payload. |
Returns | |
---|---|
PendingResult<Status> |
A PendingResult which can be used to see whether the message has been
enqueued to be sent to a Google Cast device.
|
Sets a new Cast.MessageReceivedCallback
listener on this controller for a given namespace.
The new listener will replace an existing listener for a given namespace
. Messages
received by the controller for the given namespace
will be forwarded to this
listener. The caller must have already called connect()
and received
onConnected(Bundle)
callback.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
namespace |
String : The namespace of the Cast channel. Namespaces must begin with the prefix "
urn:x-cast: ". |
callbacks |
Cast.MessageReceivedCallback : The Cast.MessageReceivedCallback to perform callbacks on. May not be
null . |
Throws | |
---|---|
IOException |
If an I/O error occurs while performing the request. |
IllegalStateException |
Thrown when the controller is not connected to a CastDevice . |
IllegalArgumentException |
If namespace is null or empty, or if the
namespace doesn't start with the prefix "urn:x-cast: ".
|
Mutes or unmutes the device's audio.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
mute |
boolean : Whether to mute or unmute the audio. |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
IOException |
If an I/O error occurs while performing the request. |
Sets the device volume. If volume
is outside of the range [0.0, 1.0], then the value
will be clipped.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
volume |
double : The new volume, in the range [0.0, 1.0]. |
Throws | |
---|---|
IllegalStateException |
If there is no active service connection. |
IllegalArgumentException |
If the volume is infinity or NaN. |
IOException |
If an I/O error occurs while performing the request. |
Stops the currently running receiver application, optionally doing so only if its session ID
matches the supplied one. If this method is called while leaveApplication(GoogleApiClient)
is pending, then this method does nothing. The Status
's status code will be INVALID_REQUEST
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
sessionId |
String : The session ID of the application to stop. sessionId cannot be
null or an empty string. |
Returns | |
---|---|
PendingResult<Status> |
A PendingResult which can be used to retrieve if the command was successful.
|
Stops any running receiver application(s). If this method is called while leaveApplication(GoogleApiClient)
is pending, then this method does nothing. The Status
's status code will be INVALID_REQUEST
.
Parameters | |
---|---|
client |
GoogleApiClient : The API client with which to perform this request. Must not be null . |
Returns | |
---|---|
PendingResult<Status> |
A PendingResult which can be used to retrieve if the command was successful.
|