Search in sources :

Example 1 with CastServiceChannel

use of com.connectsdk.service.google_cast.CastServiceChannel in project butter-android by butterproject.

the class CastWebAppSession method connect.

@Override
public void connect(final ResponseListener<Object> listener) {
    if (castServiceChannel != null) {
        disconnectFromWebApp();
    }
    castServiceChannel = new CastServiceChannel(launchSession.getAppId(), this);
    try {
        Cast.CastApi.setMessageReceivedCallbacks(service.getApiClient(), castServiceChannel.getNamespace(), castServiceChannel);
        Util.postSuccess(listener, null);
    } catch (IOException e) {
        castServiceChannel = null;
        Util.postError(listener, new ServiceCommandError(0, "Failed to create channel", null));
    }
}
Also used : CastServiceChannel(com.connectsdk.service.google_cast.CastServiceChannel) ServiceCommandError(com.connectsdk.service.command.ServiceCommandError) IOException(java.io.IOException)

Aggregations

ServiceCommandError (com.connectsdk.service.command.ServiceCommandError)1 CastServiceChannel (com.connectsdk.service.google_cast.CastServiceChannel)1 IOException (java.io.IOException)1