当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationConnectionResult类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:22,代码来源:CastService.java

示例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());
    }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:25,代码来源:ChromeCast.java

示例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);
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:21,代码来源:GameActivity.java

示例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);
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:CastService.java

示例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);
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:9,代码来源:CastService.java

示例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));
        }
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:32,代码来源:CastService.java

示例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();
                    }
                }
            });
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:33,代码来源:ChromeCastController.java

示例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());
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:13,代码来源:BaseCastManager.java

示例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;
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:dg.java

示例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));
    }
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:32,代码来源:SdkCastPlayerActivity.java

示例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());
        }
    }
}
 
开发者ID:SesamTV,项目名称:ChromecastCordova,代码行数:31,代码来源:ChromeCast.java

示例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());
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:12,代码来源:BaseCastManager.java

示例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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:6,代码来源:dg.java

示例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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:6,代码来源:dg.java

示例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);
			}
		}
 
开发者ID:qhphan,项目名称:dojoandroidcast,代码行数:50,代码来源:DojoSenderActivity.java


注:本文中的com.google.android.gms.cast.Cast.ApplicationConnectionResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。