Android Google Fit onConnectionFailed() SIGN_IN_REQUIRED

妖精的绣舞 提交于 2019-12-01 04:33:56

If you're not signed in you will get a callback to GoogleApiClient.OnConnectionFailedListener() with the error shown in your LogCat message. If you then try to resolve the problem using result.startResolutionForResult(YourActivity.this, REQUEST_CODE); the account selector dialog is displayed. Sounds to me that this is how far you've come. Is that correct?

Once you've selected an account in the dialog you need to make another connection attempt from your activity's onActivityResult(). Sounds to me like you might be missing this piece code.

On a side note: If this is the very first time you connect you will at this point get another error. Resolving that one will show the consent screen. If the user accepts, and you make yet another connection attempt you should be successfully connected to the API.

When trying to resolve this sign-in loop while adding Google Plus to Google Play services mapping, I had to add an additional API and OAuth credential for my Android app on the Google APIs console.

I already had a token credential tied to my app for the Maps APIs, but Google Plus login would return a CANCELED result code until I added the Google Plus APIs and added the required OAuth credentials for those APIs. As soon as it was in place for my APIs project, my activity result handler started seeing OK result codes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!