我有一个谷歌加登录通过GoogleApiClient
设置为应用程序。GoogleApiClient连接第一次总是失败,但第二次获得成功
只要安装该应用程序第一次尝试,使通过GoogleApiClient
方面,它永远不会成功,并且总是在onConnectionFailed
结束了result
包含:
ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{4130e760: [email protected]}}
但是当第二次登录其称之为获得成功onConnected
命中。为什么有可能在第一次尝试中取得成功?
我的Builder
参数有什么问题吗?
public void connectGoogleApi() {
mGoogleApiClient = new GoogleApiClient.Builder(mainAppContext).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
mGoogleApiClient.connect();
}
public void onConnectionFailed(ConnectionResult result) {
if (!result.hasResolution()) {
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0).show();
return;
}
if (!mIntentInProgress) {
// Store the ConnectionResult for later usage
mConnectionResult = result;
resolveSignInError();
}
}
是不是很明显的错误,用户需要允许您的应用程序进行身份验证 – tyczj
没有对话框出现,以及如何在没有用户做任何事情时获得成功? – Maven