Cast Device GoogleApiClient.onConnectionFailedListener always being called

六眼飞鱼酱① 提交于 2019-12-12 01:57:59

问题


I am having trouble debugging why my connection to a cast device is always failing but works fine in other apps that are not mine.

I am getting a reference to the cast device but i am never able to connect to that device in my own implementation using:

        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();
    }

Here is what my Log is sorry for the late update:

07-29 22:28:49.608: I/MediaRouter(2888): Unselecting the current route because it is no 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 }

What does this mean?

来源:https://stackoverflow.com/questions/25021277/cast-device-googleapiclient-onconnectionfailedlistener-always-being-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!