本文整理汇总了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);
}
}
}
};
}