本文整理汇总了Java中com.google.android.gms.cast.Cast.ApplicationConnectionResult.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationConnectionResult.getStatus方法的具体用法?Java ApplicationConnectionResult.getStatus怎么用?Java ApplicationConnectionResult.getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.cast.Cast.ApplicationConnectionResult
的用法示例。
在下文中一共展示了ApplicationConnectionResult.getStatus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入方法依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
Status status = result.getStatus();
debug("ApplicationConnectionResultCallback.onResult: statusCode" + status.getStatusCode());
if (status.isSuccess()) {
remoteMediaPlayer = new RemoteMediaPlayer();
remoteMediaPlayer.setOnStatusUpdatedListener(this);
remoteMediaPlayer.setOnMetadataUpdatedListener(this);
mSessionId = result.getSessionId();
if (!verifySession(callback)) {
return;
}
try {
Cast.CastApi.setMessageReceivedCallbacks(apiClient, remoteMediaPlayer.getNamespace(), remoteMediaPlayer);
} catch (IOException e) {
debug("Exception while creating media channel", e);
}
startPlayback();
} else {
sendError(callback, status.toString());
}
}
示例2: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入方法依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
Status status = result.getStatus();
ApplicationMetadata appMetaData = result.getApplicationMetadata();
if (status.isSuccess()) {
Log.d(TAG, "ConnectionResultCallback: " + appMetaData.getName());
mJoinGameButton.setEnabled(true);
try {
Cast.CastApi.setMessageReceivedCallbacks(mApiClient,
mGameChannel.getNamespace(), mGameChannel);
} catch (IOException e) {
Log.w(TAG, "Exception while launching application", e);
}
} else {
Log.d(TAG, "ConnectionResultCallback. Unable to launch the game. statusCode: "
+ status.getStatusCode());
mJoinGameButton.setEnabled(false);
}
}
示例3: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入方法依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result.getApplicationMetadata();
currentAppId = applicationMetadata.getApplicationId();
LaunchSession launchSession = LaunchSession.launchSessionForAppId(applicationMetadata.getApplicationId());
launchSession.setAppName(applicationMetadata.getName());
launchSession.setSessionId(result.getSessionId());
launchSession.setSessionType(LaunchSessionType.WebApp);
launchSession.setService(CastService.this);
CastWebAppSession webAppSession = new CastWebAppSession(launchSession, CastService.this);
webAppSession.setMetadata(applicationMetadata);
sessions.put(applicationMetadata.getApplicationId(), webAppSession);
if (listener != null) {
listener.onSuccess(webAppSession);
}
launchingAppId = null;
}
else {
if (listener != null) {
listener.onFailure(new ServiceCommandError(status.getStatusCode(), status.getStatusMessage(), status));
}
}
}
示例4: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入方法依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
Status status = result.getStatus();
Log.d(mClassTag, "ApplicationConnectionResultCallback.onResult: statusCode"
+ status.getStatusCode());
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result.getApplicationMetadata();
String sessionId = result.getSessionId();
String applicationStatus = result.getApplicationStatus();
boolean wasLaunched = result.getWasLaunched();
Log.d(mClassTag, "application name: " + applicationMetadata.getName()
+ ", status: " + applicationStatus + ", sessionId: " + sessionId
+ ", wasLaunched: " + wasLaunched);
setApplicationStatus(applicationStatus);
attachMediaPlayer();
mAppMetadata = applicationMetadata;
startRefreshTimer();
updateButtonStates();
Log.d(mClassTag, "mShouldPlayMedia is " + mShouldPlayMedia);
if (mShouldPlayMedia) {
mShouldPlayMedia = false;
Log.d(mClassTag, "now loading media");
playMedia(mSelectedMedia);
} else {
// Synchronize with the receiver's state.
requestMediaStatus();
}
} else {
showErrorDialog(getString(R.string.error_app_launch_failed));
}
}
示例5: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入方法依赖的package包/类
@Override
public void onResult(
ApplicationConnectionResult result) {
Status status = result.getStatus();
Log.d(mClassTag,
"ApplicationConnectionResultCallback.onResult: statusCode"
+ status.getStatusCode()
);
if (status.isSuccess()) {
ApplicationMetadata applicationMetadata = result
.getApplicationMetadata();
String sessionId = result
.getSessionId();
String applicationStatus = result
.getApplicationStatus();
boolean wasLaunched = result
.getWasLaunched();
Log.d(mClassTag, "application name: "
+ applicationMetadata
.getName()
+ ", status: "
+ applicationStatus
+ ", sessionId: "
+ sessionId
+ ", wasLaunched: "
+ wasLaunched);
mApplicationStarted = true;
mMediaPlayer = new com.sesamtv.cordova.chromecast.MediaPlayer(mApiClient, ChromeCast.this);
mMediaPlayer.attachMediaPlayer();
onSessionStarted(result);
clearChannelsQueue();
// set the initial instructions
// on the receiver
//sendMessage(getString(R.string.instructions));
} else {
Log.e(mClassTag,
"application could not launch");
teardown();
}
}