好的,这对我来说很难调试,因为我没有遇到很多应用程序用户似乎遇到的问题。 如果您想自己尝试,可以通过搜索“ syncquik”在iTunes上下载该应用程序。 问题:当用户尝试通过Facebook登录按钮登录我的应用程序时,第一次打开活动FB会话的尝试通常会失败。 起初,我认为这是因为 ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我通过GoogleApiClient
为应用设置了google plus登录。
每当第一次安装应用程序并尝试通过GoogleApiClient
建立连接时,它永远不会成功,并且总是以onConnectionFailed
结束, result
包含:
ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{4130e760: android.os.BinderProxy@4130e700}}
但是当第二次登录时,它被称为成功并且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();
}
}
作为官方的文档说在这里 :
如果您使用GoogleApiClient连接到需要身份验证的API(例如Google云端硬盘或Google Play游戏),您的第一次连接尝试很可能会失败,并且您的应用会收到带有SIGN_IN_REQUIRED错误的onConnectionFailed()调用,因为该用户帐户未指定。
我有同样的问题,再次调用'connect()',这次在'onConnected'方法中修复了它。 奇怪。
@Override
public void onConnected(final Bundle arg0) {
Logger.log("On connected");
DevicePreferences.getGoogleApiClient().connect();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.