Android Google Fit onConnectionFailed()SIGN_IN_REQUIRED

时间:2015-01-26 16:28:37

标签: android google-fit google-fit-sdk

我似乎无法绕过这个问题。我就是无法登录。

我正在运行BasicSensorApi示例文件,它只是无法连接。 即使我在对话框中选择了一个帐户,我似乎也得到了RESULT_CANCELED?

这是我在OnePlus One 4.4上运行的logcat的结束。

关于我需要做什么的任何想法?

(Google控制台设置为'net.xx',正确的SHA1,启用了Fitness APi。

01-26 15:54:06.838  15678-15678/net.xx D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
01-26 15:54:06.888  15678-15678/net.xx I/BasicSensorsApi﹕ Ready
01-26 15:54:06.898  15678-15678/net.xx I/BasicSensorsApi﹕ Connecting...

01-26 15:54:07.008  15678-15678/net.xx D/OpenGLRenderer﹕ Enabling debug mode 0
01-26 15:54:07.018  15678-15678/net.xx I/BasicSensorsApi﹕ Connection failed. Cause: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41c147e8: android.os.BinderProxy@41c14788}}
01-26 15:54:07.458  15678-15678/net.xx I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@418ce750 time:11713882
01-26 15:54:09.898  15678-15678/net.xx I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@418ce750 time:11716323

2 个答案:

答案 0 :(得分:6)

如果您未登录,则会收到GoogleApiClient.OnConnectionFailedListener()的回复,并显示LogCat消息中显示的错误。如果您然后尝试使用解决问题 result.startResolutionForResult(YourActivity.this, REQUEST_CODE);显示帐户选择器对话框。听我说这就是你走了多远。这是对的吗?

在对话框中选择了一个帐户后,您需要在活动onActivityResult()中再次尝试连接。听起来像你可能会错过这段代码。

旁注:如果这是您第一次连接,此时您将收到另一个错误。解决该问题将显示同意屏幕。如果用户接受了,并且您进行了另一次连接尝试,则应该成功连接到API。

答案 1 :(得分:0)

在将Google Plus添加到Google Play服务映射时尝试解决此登录循环时,我必须在Google APIs console上为我的Android应用添加其他API和OAuth凭据。

我已经有一个令牌凭据与我的地图API API应用相关联,但Google Plus登录会返回一个取消的结果代码,直到我添加了Google Plus API并为这些API添加了所需的OAuth凭据。一旦我的API项目到位,我的活动结果处理程序就开始看到OK结果代码。