本文整理匯總了Java中com.google.android.gms.common.api.CommonStatusCodes.SIGN_IN_REQUIRED屬性的典型用法代碼示例。如果您正苦於以下問題:Java CommonStatusCodes.SIGN_IN_REQUIRED屬性的具體用法?Java CommonStatusCodes.SIGN_IN_REQUIRED怎麽用?Java CommonStatusCodes.SIGN_IN_REQUIRED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.google.android.gms.common.api.CommonStatusCodes
的用法示例。
在下文中一共展示了CommonStatusCodes.SIGN_IN_REQUIRED屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onResult
@Override
public void onResult(@NonNull Status status) {
if (status.isSuccess()) {
login();
} else if (status.hasResolution() && status.getStatusCode() != CommonStatusCodes.SIGN_IN_REQUIRED) {
try {
status.startResolutionForResult(LoginActivity.this, GoogleApiAdapter.REGISTER_CREDENTIAL);
} catch (IntentSender.SendIntentException e) {
// We couldn't register, but we have to keep on
login();
}
}
}
示例2: onCredentialRetrievalError
void onCredentialRetrievalError(Activity activity, Status status, int requestCode) {
if (status.hasResolution() && status.getStatusCode() != CommonStatusCodes.SIGN_IN_REQUIRED) {
try {
status.startResolutionForResult(activity, requestCode);
} catch (IntentSender.SendIntentException e) {
Log.e(TAG, "Failed to send intent for Smart Lock resolution", e);
startLockFromActivity(activity);
}
} else {
Log.e(TAG, "Couldn't read the credentials using Smart Lock. Showing Lock...");
startLockFromActivity(activity);
}
}
示例3: onResult
@Override
public void onResult(LoadPeopleResult peopleData) {
switch (peopleData.getStatus().getStatusCode()) {
case CommonStatusCodes.SUCCESS:
mListItems.clear();
PersonBuffer personBuffer = peopleData.getPersonBuffer();
try {
int count = personBuffer.getCount();
for (int i = 0; i < count; i++) {
mListItems.add(personBuffer.get(i).getDisplayName());
}
} finally {
personBuffer.close();
}
mListAdapter.notifyDataSetChanged();
break;
case CommonStatusCodes.SIGN_IN_REQUIRED:
mGoogleApiClient.disconnect();
mGoogleApiClient.connect();
break;
default:
Log.e(TAG, "Error when listing people: " + peopleData.getStatus());
break;
}
}
示例4: onResult
@Override
public void onResult(LoadMomentsResult momentData) {
switch (momentData.getStatus().getStatusCode()) {
case CommonStatusCodes.SUCCESS:
MomentBuffer momentBuffer = momentData.getMomentBuffer();
mListItems.clear();
try {
int count = momentBuffer.getCount();
for (int i = 0; i < count; i++) {
mListItems.add(momentBuffer.get(i).freeze());
}
} finally {
momentBuffer.close();
}
mMomentListAdapter.notifyDataSetChanged();
break;
case CommonStatusCodes.SIGN_IN_REQUIRED:
mGoogleApiClient.disconnect();
mGoogleApiClient.connect();
break;
default:
Log.e(TAG, "Error when listing moments: " + momentData.getStatus());
break;
}
}
示例5: onResult
@Override
public void onResult(Status status) {
switch (status.getStatusCode()) {
case CommonStatusCodes.SUCCESS:
Toast.makeText(this, getString(R.string.plus_write_moment_status_success),
Toast.LENGTH_SHORT).show();
break;
case CommonStatusCodes.SUCCESS_CACHE:
Toast.makeText(this, getString(R.string.plus_write_moment_status_cached),
Toast.LENGTH_SHORT).show();
break;
case CommonStatusCodes.SIGN_IN_REQUIRED:
Toast.makeText(this, getString(R.string.plus_write_moment_status_auth_error),
Toast.LENGTH_SHORT).show();
mGoogleApiClient.disconnect();
mGoogleApiClient.connect();
break;
default:
Toast.makeText(this, getString(R.string.plus_write_moment_status_error),
Toast.LENGTH_SHORT).show();
Log.e(TAG, "Error when writing moments: " + status);
break;
}
}