Java Code Examples for com.google.android.gms.cast.Cast#ApplicationConnectionResult

The following examples show how to use com.google.android.gms.cast.Cast#ApplicationConnectionResult . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateRouteRequest.java    From delion with Apache License 2.0 6 votes vote down vote up
private void reportSuccess(Cast.ApplicationConnectionResult result) {
    if (mState != STATE_LAUNCH_SUCCEEDED) throwInvalidState();

    CastSession session = new CastSessionImpl(
            mApiClient,
            result.getSessionId(),
            result.getApplicationMetadata(),
            result.getApplicationStatus(),
            mSink.getDevice(),
            mOrigin,
            mTabId,
            mIsIncognito,
            mSource,
            mRouteProvider);
    mCastListener.setSession(session);
    mRouteProvider.onSessionCreated(session);

    terminate();
}
 
Example 2
Source File: CreateRouteRequest.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onResult(Cast.ApplicationConnectionResult result) {
    if (mState != STATE_LAUNCHING_APPLICATION
            && mState != STATE_API_CONNECTION_SUSPENDED) {
        throwInvalidState();
    }

    Status status = result.getStatus();
    if (!status.isSuccess()) {
        Log.e(TAG, "Launch application failed with status: %s, %d, %s",
                mSource.getApplicationId(), status.getStatusCode(), status.getStatusMessage());
        reportError();
    }

    mState = STATE_LAUNCH_SUCCEEDED;
    reportSuccess(result);
}
 
Example 3
Source File: CreateRouteRequest.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void reportSuccess(Cast.ApplicationConnectionResult result) {
    if (mState != STATE_LAUNCH_SUCCEEDED) throwInvalidState();

    CastSession session = new CastSessionImpl(
            mApiClient,
            result.getSessionId(),
            result.getApplicationMetadata(),
            result.getApplicationStatus(),
            mSink.getDevice(),
            mOrigin,
            mTabId,
            mIsIncognito,
            mSource,
            mRouteProvider);
    mCastListener.setSession(session);
    mRouteProvider.onSessionCreated(session);

    terminate();
}
 
Example 4
Source File: CreateRouteRequest.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onResult(Cast.ApplicationConnectionResult result) {
    if (mState != STATE_LAUNCHING_APPLICATION
            && mState != STATE_API_CONNECTION_SUSPENDED) {
        throwInvalidState();
    }

    Status status = result.getStatus();
    if (!status.isSuccess()) {
        Log.e(TAG, "Launch application failed with status: %s, %d, %s",
                mSource.getApplicationId(), status.getStatusCode(), status.getStatusMessage());
        reportError();
        return;
    }

    mState = STATE_LAUNCH_SUCCEEDED;
    reportSuccess(result);
}
 
Example 5
Source File: CreateRouteRequest.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void reportSuccess(Cast.ApplicationConnectionResult result) {
    if (mState != STATE_LAUNCH_SUCCEEDED) throwInvalidState();

    CastSession session = new CastSessionImpl(
            mApiClient,
            result.getSessionId(),
            result.getApplicationMetadata(),
            result.getApplicationStatus(),
            mSink.getDevice(),
            mOrigin,
            mTabId,
            mIsIncognito,
            mSource,
            mRouteProvider);
    mCastListener.setSession(session);
    mRouteProvider.onSessionCreated(session);

    terminate();
}
 
Example 6
Source File: ChromeCastController.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
ConnectionCallbacks(boolean isPlaying, int position) {
	this.isPlaying = isPlaying;
	this.position = position;

	resultCallback = new ResultCallback<Cast.ApplicationConnectionResult>() {
		@Override
		public void onResult(Cast.ApplicationConnectionResult result) {
			Status status = result.getStatus();
			if (status.isSuccess()) {
				ApplicationMetadata applicationMetadata = result.getApplicationMetadata();
				sessionId = result.getSessionId();
				String applicationStatus = result.getApplicationStatus();
				boolean wasLaunched = result.getWasLaunched();

				applicationStarted = true;
				setupChannel();
			} else {
				shutdownInternal();
			}
		}
	};
}
 
Example 7
Source File: CreateRouteRequest.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private PendingResult<Cast.ApplicationConnectionResult> launchApplication(
        GoogleApiClient apiClient,
        String appId,
        boolean relaunchIfRunning) {
    LaunchOptions.Builder builder = new LaunchOptions.Builder();
    return Cast.CastApi.launchApplication(apiClient, appId,
            builder.setRelaunchIfRunning(relaunchIfRunning)
                    .build());
}
 
Example 8
Source File: CreateRouteRequest.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private PendingResult<Cast.ApplicationConnectionResult> launchApplication(
        GoogleApiClient apiClient,
        String appId,
        boolean relaunchIfRunning) {
    return Cast.CastApi.launchApplication(apiClient, appId, relaunchIfRunning);
}
 
Example 9
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client) {
    return null;
}
 
Example 10
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client, String applicationId, String sessionId) {
    return null;
}
 
Example 11
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> joinApplication(GoogleApiClient client, String applicationId) {
    return null;
}
 
Example 12
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId, LaunchOptions launchOptions) {
    return null;
}
 
Example 13
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId) {
    return null;
}
 
Example 14
Source File: CastApiImpl.java    From android_external_GmsLib with Apache License 2.0 4 votes vote down vote up
@Override
public PendingResult<Cast.ApplicationConnectionResult> launchApplication(GoogleApiClient client, String applicationId, boolean relaunchIfRunning) {
    return null;
}