问题
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