com.google.android.gms.cast.Cast.CastApi |
The main entry point for interacting with a Google Cast device.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the metadata for the currently running receiver application, if any.
| |||||||||||
Returns the current receiver application status, if any.
| |||||||||||
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) an application on the receiver.
| |||||||||||
Joins (connects to) the currently running application on the receiver.
| |||||||||||
Launches an application on the receiver.
| |||||||||||
Launches an application on the receiver.
| |||||||||||
This method is deprecated.
Use
launchApplication(GoogleApiClient, String, LaunchOptions) .
| |||||||||||
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 any running receiver application(s).
| |||||||||||
Stops the currently running receiver application, optionally doing so only if its session
ID matches the supplied one.
|
Returns the metadata for the currently running receiver application, if any.
client | The API client with which to perform this request. Must not be
null . |
---|
null
if no application is currently running
on the receiver.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.
client | The API client with which to perform this request. Must not be
null . |
---|
null
if no application is currently
running on the receiver or if the receiver application has not provided any
status text.IllegalStateException | If there is no active service connection. |
---|
Returns the device's volume, in the range [0.0, 1.0].
client | The API client with which to perform this request. Must not be
null . |
---|
IllegalStateException | If there is no active service connection. |
---|
Returns the device's mute state.
client | The API client with which to perform this request. Must not be
null . |
---|
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
.
client | The API client with which to perform this request. Must not be
null . |
---|
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
applicationId | The ID of the receiver application to connect to, or null to
connect to the currently running application. |
sessionId | The expected session ID of the receiver application, or null to
connect without checking for a matching session ID. |
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
applicationId | The ID of the receiver application to connect to, or null to
connect to the currently running application. |
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
applicationId | The ID of the receiver application to launch. |
launchOptions | The launch options for the request. |
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
applicationId | The ID of the receiver application to launch. |
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
applicationId | The ID of the receiver application to launch. |
relaunchIfRunning | If true , relaunches the application if it is already
running. |
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
.
client | The API client with which to perform this request. Must not be
null . |
---|
PendingResult
which can be used to retrieve if the command was
successful.
Removes a Cast.MessageReceivedCallback
from this controller for a given namespace.
client | The API client with which to perform this request. Must not be
null . |
---|---|
namespace | The namespace of the Cast channel. Namespaces must begin with the prefix
"urn:x-cast: ". |
IOException | If an I/O error occurs while performing the request. |
---|---|
IllegalArgumentException | If namespace is null or empty.
|
Requests the receiver's current status.
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.
client | The API client with which to perform this request. Must not be
null . |
---|---|
namespace | The namespace for the message. Namespaces must begin with the prefix "
urn:x-cast: ". |
message | The message payload. |
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.
client | The API client with which to perform this request. Must not be
null . |
---|---|
namespace | The namespace of the Cast channel. Namespaces must begin with the prefix
"urn:x-cast: ". |
callbacks | The Cast.MessageReceivedCallback to perform callbacks on. May not be
null . |
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.
client | The API client with which to perform this request. Must not be
null . |
---|---|
mute | Whether to mute or unmute the audio. |
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.
client | The API client with which to perform this request. Must not be
null . |
---|---|
volume | The new volume, in the range [0.0, 1.0]. |
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 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
.
client | The API client with which to perform this request. Must not be
null . |
---|
PendingResult
which can be used to retrieve if the command was
successful.
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
.
client | The API client with which to perform this request. Must not be
null . |
---|---|
sessionId | The session ID of the application to stop. sessionId cannot be
null or an empty string. |
PendingResult
which can be used to retrieve if the command was
successful.