本文整理匯總了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)));
}
}
示例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();
}
示例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);
}
}
}
};
}