Android Google Fit onConnectionFailed() SIGN_IN_REQUIRED

后端 未结 2 602
迷失自我
迷失自我 2021-01-12 17:19

I can\'t seem to get round this issue. I just cannot sign in.

I\'m running the BasicSensorApi sample file and it just will not connect. It seems i\'m getting RESULT_

相关标签:
2条回答
  • 2021-01-12 18:19

    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.

    0 讨论(0)
  • 2021-01-12 18:20

    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.

    0 讨论(0)
提交回复
热议问题