问题
I am developing an Android app with CastRemoteDisplay
(Cast SDK v2). When another app starts casting, I want to ensure my app stops casting, so I create my CastOptionsBuilder
with the following listener:
Cast.Listener listener = new Cast.Listener() {
@Override
public void onApplicationMetadataChanged(ApplicationMetadata metadata) {
String backdropId = "E8C28D3C"; // id of the Cast backdrop app
if (!(metadata == null
|| metadata.getApplicationId().equals(backdropId)
|| metadata.getApplicationId().equals(MY_APP_ID)) {
mMediaRouter.unselect(MediaRouter.UNSELECT_REASON_STOPPED);
}
}
};
Then setup the GoogleApiClient
with:
GoogleApiClient client = (new GoogleApiClient.Builder(this, callbacks, connectFailListener))
.addApi(CastRemoteDisplay.API, castRemoteDisplayOptionsBuilder.build())
.addApi(Cast.API, castOptionsBuilder.build())
.build();
My question: is it permitted to use both CastRemoteDisplay.API
and Cast.API
on the same GoogleApiClient
?
来源:https://stackoverflow.com/questions/39836864/can-one-use-castremotedisplay-api-and-cast-api-on-the-same-googleapiclient