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


Java ConnectionResult.getResolution方法代码示例

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


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

示例1: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult result) {
    LOGD(TAG, "onConnectionFailed() reached, error code: " + result.getErrorCode()
            + ", reason: " + result.toString());
    disconnectDevice(mDestroyOnDisconnect, false /* clearPersistentConnectionData */,
            false /* setDefaultRoute */);
    mConnectionSuspended = false;
    if (mMediaRouter != null) {
        mMediaRouter.selectRoute(mMediaRouter.getDefaultRoute());
    }

    for (BaseCastConsumer consumer : mBaseCastConsumers) {
        consumer.onConnectionFailed(result);
    }

    PendingIntent pendingIntent = result.getResolution();
    if (pendingIntent != null) {
        try {
            pendingIntent.send();
        } catch (PendingIntent.CanceledException e) {
            LOGE(TAG, "Failed to show recovery from the recoverable error", e);
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:25,代码来源:BaseCastManager.java

示例2: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult result) {
    Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());

    if (result.getErrorCode() == SERVICE_MISSING){
        showMessage("Google Drive API not Found on this Device");
        Log.e(TAG, "Google Drive SERVICE_MISSING");
    }

    if (result.getErrorCode() == SERVICE_VERSION_UPDATE_REQUIRED){
        showMessage("Google Play Services update required. Please update in Google Play store.");
        Log.e(TAG, "Google Play Services update required");
        mGoogleApiClient.getContext().startActivity(new Intent(mGoogleApiClient.getContext(), MainActivity.class)
                .putExtra("PlayServicesUpdate", true).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    }

    PendingIntent pI = result.getResolution();
    if (pI != null) {
        Log.v(TAG, "PendingIntent: " + pI.getIntentSender().toString());
        mGoogleApiClient.getContext().startActivity(new Intent(mGoogleApiClient.getContext(), MainActivity.class)
                .putExtra("resolution", pI).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    } else {
        Log.e(TAG, "Pending Intent resolution was Null");
    }

    // If we don't stop this service, we tend to have an invalid API client
    // when we call the first Create new Drive file command
    stopSelf(mStartID);
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:30,代码来源:SyncToDriveService.java


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