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


Java ApplicationConnectionResult.getApplicationMetadata方法代码示例

本文整理汇总了Java中com.google.android.gms.cast.Cast.ApplicationConnectionResult.getApplicationMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationConnectionResult.getApplicationMetadata方法的具体用法?Java ApplicationConnectionResult.getApplicationMetadata怎么用?Java ApplicationConnectionResult.getApplicationMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.cast.Cast.ApplicationConnectionResult的用法示例。


在下文中一共展示了ApplicationConnectionResult.getApplicationMetadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例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();
        mSessionId = result.getSessionId();
        String applicationStatus = result.getApplicationStatus();
        boolean wasLaunched = result.getWasLaunched();
        mApplicationStarted = true;

        // Create the custom message
        // channel
        mMirrorChannel = new MirrorChannel();
        try {
            Cast.CastApi.setMessageReceivedCallbacks(apiClient,
                                                     mMirrorChannel
                                                     .getNamespace(),
                                                     mMirrorChannel);
            sendSuccess(callback, null);
        } catch (IOException e) {
            Log.e(LOGTAG, "Exception while creating channel", e);
        }

        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Casting:Mirror", route.getId()));
    } else {
        sendError(callback, status.toString());
    }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:29,代码来源:ChromeCast.java

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

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


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