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