當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。