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


Java CommonStatusCodes.RESOLUTION_REQUIRED属性代码示例

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


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

示例1: resolveResult

private void resolveResult(Status status) {
    if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
        try {
            //status.startResolutionForResult(mActivity, RC_READ);
            startIntentSenderForResult(status.getResolution().getIntentSender(), RC_READ, null, 0, 0, 0, null);
        } catch (IntentSender.SendIntentException e) {
            e.printStackTrace();
            mCredentialsApiClient.disconnect();
            mAccountSubject.onError(new Throwable(e.toString()));
        }
    }
    else {
        // The user must create an account or sign in manually.
        mCredentialsApiClient.disconnect();
        mAccountSubject.onError(new Throwable(getString(R.string.status_canceled_request_credential)));
    }
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:17,代码来源:RxSmartLockPasswordsFragment.java

示例2: onResult

@Override
public void onResult(@NonNull CredentialRequestResult result) {
    Status status = result.getStatus();

    if (status.isSuccess()) {
        // Auto sign-in success
        handleCredential(result.getCredential());
        return;
    } else {
        if (status.hasResolution()) {
            try {
                if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
                    startIntentSenderForResult(
                            status.getResolution().getIntentSender(),
                            RC_CREDENTIALS_READ);
                    return;
                }
            } catch (IntentSender.SendIntentException e) {
                Log.e(TAG, "Failed to send Credentials intent.", e);
            }
        } else {
            Log.e(TAG, "Status message:\n" + status.getStatusMessage());
        }
    }
    startAuthMethodChoice();
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:26,代码来源:SignInDelegate.java

示例3: getLocationSettingsResultCallback

@NonNull
private ResultCallback<Result> getLocationSettingsResultCallback() {
    return new ResultCallback<Result>() {
        @Override
        public void onResult(@NonNull Result result) {
            Status status = result.getStatus();
            if (status.getStatusCode() == CommonStatusCodes.SUCCESS) {
                Log.i(TAG, "All location settings are satisfied.");
                Runnable requestUpdatesTask = new OnPermissionsTask();
                if (isConnected()) requestUpdatesTask.run();
                else {
                    mOnConnectedUpdateCallback = requestUpdatesTask;
                    Log.d(TAG, "Google API is not connected. "
                            + "Updates delayed until Google API is connected again.");
                }
            } else if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
                Log.i(TAG, "Location settings are not satisfied. "
                        + "Showing the user a dialog to upgrade location settings.");
                try {
                    setRequestingPermissions(true);
                    // Show the dialog by calling startResolutionForResult(),
                    // and check the result in the onActivityResult() of mContext
                    status.startResolutionForResult(mContext, REQUEST_CHECK_SETTINGS);
                } catch (IntentSender.SendIntentException e) {
                    Log.wtf(TAG, "PendingIntent unable to execute request", e);
                }
            } else if (status.getStatusCode()
                    == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
                if (checkNetwork()) {
                    Log.w(TAG, "Location settings can't be changed to meet the requirements");
                    setHasPermissions(false);
                    mOnPermissionsChangedListeners.run();
                    setRequestingPermissions(false);
                }
            }
        }
    };
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:38,代码来源:LocationAdapter.java


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