本文整理汇总了Java中com.google.android.gms.cast.Cast.ApplicationConnectionResult类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationConnectionResult类的具体用法?Java ApplicationConnectionResult怎么用?Java ApplicationConnectionResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationConnectionResult类属于com.google.android.gms.cast.Cast包,在下文中一共展示了ApplicationConnectionResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnected
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
@Override
public void onConnected(Bundle connectionHint) {
Log.d(Util.T, "ConnectionCallbacks.onConnected, wasWaitingForReconnect: " + mWaitingForReconnect);
attachMediaPlayer();
if (mApiClient != null && mApiClient.isConnected()) {
try {
mCastClient.joinApplication(mApiClient)
.setResultCallback(new ResultCallback<ApplicationConnectionResult>() {
@Override
public void onResult(ApplicationConnectionResult result) {
onJoinApplicationResult(result);
}
});
} catch (CastClientException e) {
Log.e(Util.T, "join application error", e);
}
}
}
示例2: 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());
}
}
示例3: 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);
}
}
示例4: launchApplication
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
public PendingResult<ApplicationConnectionResult> launchApplication(
GoogleApiClient mApiClient, String mediaAppId, LaunchOptions options)
throws CastClientException {
try {
return Cast.CastApi.launchApplication(mApiClient, mediaAppId, options);
} catch (RuntimeException e) {
throw createCastClientException(e);
}
}
示例5: joinApplication
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
public PendingResult<ApplicationConnectionResult> joinApplication(
GoogleApiClient mApiClient) throws CastClientException {
try {
return Cast.CastApi.joinApplication(mApiClient);
} catch (RuntimeException e) {
throw createCastClientException(e);
}
}
示例6: 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));
}
}
}
示例7: launchApplication
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
/**
* Receiverアプリケーションを起動する.
*
*/
private void launchApplication() {
if (mApiClient != null && mApiClient.isConnected()) {
Cast.CastApi.launchApplication(mApiClient, mAppId)
.setResultCallback(new ResultCallback<Cast.ApplicationConnectionResult>() {
@Override
public void onResult(final ApplicationConnectionResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
if (BuildConfig.DEBUG) {
Log.d("TEST", "launchApplication$onResult: Success");
}
for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).onAttach();
}
} else {
if (BuildConfig.DEBUG) {
Log.d("TEST", "launchApplication$onResult: Fail");
}
teardown();
}
if (mResult != null) {
mResult.onChromeCastConnected();
}
}
});
}
}
示例8: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
if (result.getStatus().isSuccess()) {
LOGD(TAG, "launchApplication() -> success result");
onApplicationConnected(result.getApplicationMetadata(),
result.getApplicationStatus(), result.getSessionId(),
result.getWasLaunched());
} else {
LOGD(TAG, "launchApplication() -> failure result");
onApplicationConnectionFailed(result.getStatus().getStatusCode());
}
}
示例9: d
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
private void d(a.c<Cast.ApplicationConnectionResult> paramc)
{
synchronized (lQ)
{
if (this.lO != null)
this.lO.a(new a(new Status(2002)));
this.lO = paramc;
return;
}
}
示例10: 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));
}
}
示例11: onSessionStarted
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
private void onSessionStarted(ApplicationConnectionResult result) {
if (setReceiverCallback != null) {
setReceiverCallback.success();
setReceiverCallback = null;
}
if (onSessionCreatedCallback != null) {
try {
JSONObject info = new JSONObject();
info.put("appId", APP_ID);
info.put("sessionId", result.getSessionId());
info.put("displayName", result.getApplicationMetadata().getName());
info.put("statusCode", result.getStatus().getStatusCode());
info.put("wasLaunched", result.getWasLaunched());
ArrayList<JSONObject> media = new ArrayList<JSONObject>();
if (mMediaPlayer != null) {
JSONObject mediaStatus = mMediaPlayer.getMediaStatus();
if (mediaStatus.has("contentId")) {
media.add(mediaStatus);
}
}
info.put("media", media);
PluginResult res = new PluginResult(PluginResult.Status.OK, info);
res.setKeepCallback(true);
onSessionCreatedCallback.sendPluginResult(res);
} catch (JSONException e) {
Log.e(TAG, e.getMessage());
}
}
}
示例12: onResult
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
if (result.getStatus().isSuccess()) {
CastUtils.LOGD(TAG, "launchApplication() -> success result");
onApplicationConnected(result.getApplicationMetadata(), result.getApplicationStatus(), result
.getSessionId(), result.getWasLaunched());
} else {
CastUtils.LOGD(TAG, "launchApplication() -> failure result");
onApplicationConnectionFailed(result.getStatus().getStatusCode());
}
}
示例13: a
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
public final void a(String paramString, boolean paramBoolean, a.c<Cast.ApplicationConnectionResult> paramc)
{
d(paramc);
((di)bQ()).c(paramString, paramBoolean);
}
示例14: b
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
public final void b(String paramString1, String paramString2, a.c<Cast.ApplicationConnectionResult> paramc)
{
d(paramc);
((di)bQ()).b(paramString1, paramString2);
}
示例15: onConnected
import com.google.android.gms.cast.Cast.ApplicationConnectionResult; //导入依赖的package包/类
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected");
if (mApiClient == null) {
// We got disconnected while this runnable was pending
// execution.
return;
}
try {
// if (mWaitingForReconnect) {
// mWaitingForReconnect = false;
//
// // Check if the receiver app is still running
// if ((connectionHint != null)
// && connectionHint
// .getBoolean(Cast.EXTRA_APP_NO_LONGER_RUNNING)) {
// Log.d(TAG, "App is no longer running");
// teardown();
// } else {
// // Re-create the custom message channel
// try {
// Cast.CastApi.setMessageReceivedCallbacks(
// mApiClient,
// mHelloWorldChannel.getNamespace(),
// mHelloWorldChannel);
// } catch (IOException e) {
// Log.e(TAG, "Exception while creating channel", e);
// }
// }
// } else {
// Launch the receiver app
Cast.CastApi
.launchApplication(mApiClient,
getString(R.string.app_id), false)
.setResultCallback(new ResultCallback<Cast.ApplicationConnectionResult>() {
@Override
public void onResult(
ApplicationConnectionResult result) {
// TODO Auto-generated method stub
sendMessage("{\"type\":\"setAngle\", \"x\": 2, \"y\": 2}");
}
});
// }
} catch (Exception e) {
Log.e(TAG, "Failed to launch application", e);
}
}