始终调用Cast设备GoogleApiClient.onConnectionFailedListener

时间:2014-07-29 17:17:30

标签: android chromecast google-cast

我无法调试为什么我与演员设备的连接总是失败但在其他不属于我的应用程序中工作正常。

我正在获取对转换设备的引用,但我无法使用以下方法在我自己的实现中连接到该设备:

        private void connectToCastDevice(CastDevice currentDevice) {

        // Create the CastOptions.Builder
        Cast.CastOptions apiOptionsBuilder = Cast.CastOptions.builder(currentDevice, mCastClientListener).build();

        // If the GoogleApiClient is not null and is Connected
        if((mGoogleApiClient != null))
        {

            // Disconnect from the Client
            mGoogleApiClient.disconnect();

            // Set the Client to null
            mGoogleApiClient = null;
        }

        // Instantiate the GoogleApiClient Object
        mGoogleApiClient = new GoogleApiClient.Builder(mContext)
                                        .addApi(Cast.API, apiOptionsBuilder)
                                        .addConnectionCallbacks(mConnectionCallbacks)
                                        .addOnConnectionFailedListener(mConnectionFailedListener).build();

        // Connect to the ApiClient
        mGoogleApiClient.connect();
    }

以下是我的日志对于更新后期的抱歉:

07-29 22:28:49.608:I / MediaRouter(2888):取消选择当前路线,因为它不是 longerselectable:MediaRouter.RouteInfo {uniqueId = com.google.android.gms / .cast.media.CastMediaRouteProviderService:16f658a34d13c744277d3755727a7762,name = old reliable,description = Chromecast,enabled = true,connecting = false,playbackType = 1,playbackStream = -1 ,volumeHandling = 0,volume = 0,volumeMax = 20,presentationDisplayId = -1,extras = Bundle [{com.google.android.gms.cast.EXTRA_CAST_DEVICE =“old reliable”(16f658a34d13c744277d3755727a7762)}],providerPackageName = com.google .android.gms}

这是什么意思?

0 个答案:

没有答案