【发布时间】:2017-07-13 02:38:26
【问题描述】:
当用户按下登录按钮时,帐户选择器会启动。如果他们按下除了帐户选择器之外的屏幕上的其他位置,它会关闭并 logcat 报告:
W/SignInActivity: onSignInFailed()...
Sign in failed during 2
==> Returning non-OK result: 0
W/AutoManageHelper: Unresolved error while connecting client. Stopping auto-manage.
然后调用 OnActivityResult()
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task =
GoogleSignIn.getSignedInAccountFromIntent(intent);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
onConnected(account);
} catch (ApiException apiException) {
String message = apiException.getMessage();
if (message == null || message.isEmpty()) {
message = getString(R.string.signin_other_error);
}
onDisconnected();
if(message.startsWith("13")){
new AlertDialog.Builder(MainActivity.this)
.setTitle(R.string.alert_nologin_title)
.setMessage(R.string.alert_nologin_message)
.setNeutralButton(android.R.string.ok, null)
.show();
}else{
new AlertDialog.Builder(this)
.setMessage(message)
.setNeutralButton(android.R.string.ok, null)
.show();
}
}
}
}
发生这种情况时,AlertDialog.Builder 正在显示一条消息 13:,因此我包含了 if 语句来解决和针对这种特定情况。
该应用已在 Google Play 管理中心注册,可以正常连接,没有问题。以前这个问题也会导致应用程序崩溃,但现在不再是这种情况了,用户现在可以随意关闭或登录/注销,并且应用程序将保持稳定。
如果需要更多信息,该项目托管在 GitHub 上:https://github.com/MDodd423/TapAttack
感谢您的帮助。
【问题讨论】:
标签: android google-play-services google-play-games