Cast.Listener Stay organized with collections Save and categorize content based on your preferences.
Page Summary
Cast.Listener is a class that provides callbacks for events occurring when connected to a Google Cast device.
It includes methods to notify about changes in the active input state, application connection status, application metadata, application status, device name, standby state, and volume/mute state.
These callbacks can be triggered at any time while connected to a Google Cast device.
The list ofCast callbacks. These callbacks may get called at any time, when connected to a Google Cast device.
Public Constructor Summary
Listener() |
Public Method Summary
| void | onActiveInputStateChanged(int activeInputState) Called when the active-input state of the device has changed. |
| void | onApplicationDisconnected(int statusCode) Called when the connection to the receiver application has been lost, such as when another client has launched a new application. |
| void | onApplicationMetadataChanged(ApplicationMetadata applicationMetadata) Called when the application metadata of the currently running receiver application has changed. |
| void | onApplicationStatusChanged() Called when the status of the connected application has changed. |
| void | onDeviceNameChanged() Called when the device's name has changed. |
| void | onStandbyStateChanged(int standbyState) Called when the standby state of the device has changed. |
| void | onVolumeChanged() Called when the device's volume or mute state has changed. |
Inherited Method Summary
Public Constructors
publicListener()
Public Methods
public voidonActiveInputStateChanged(int activeInputState)
Called when the active-input state of the device has changed.
Parameters
| activeInputState | The new active-input state. One of the constants Cast.ACTIVE_INPUT_STATE_UNKNOWN,Cast.ACTIVE_INPUT_STATE_NO,Cast.ACTIVE_INPUT_STATE_YES. |
|---|
public voidonApplicationDisconnected(int statusCode)
Called when the connection to the receiver application has been lost, such as when another client has launched a new application.
Parameters
| statusCode | A status code indicating the reason for the disconnect. One of the error constants defined inCastStatusCodes. |
|---|
public voidonApplicationMetadataChanged(ApplicationMetadata applicationMetadata)
Called when the application metadata of the currently running receiver application has changed. This will happen whenever a receiver application launches or terminates.
Parameters
| applicationMetadata | The new application metadata. May benull if no application is currently running. |
|---|
public voidonApplicationStatusChanged()
Called when the status of the connected application has changed.
public voidonDeviceNameChanged()
Called when the device's name has changed.
public voidonStandbyStateChanged(int standbyState)
Called when the standby state of the device has changed.
Parameters
| standbyState | The new standby state. One of the constantsCast.STANDBY_STATE_UNKNOWN,Cast.STANDBY_STATE_NO, orCast.STANDBY_STATE_YES. |
|---|
public voidonVolumeChanged()
Called when the device's volume or mute state has changed.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.