Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Fit onConnectionFailed() SIGN_IN_REQUIRED

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_CANCELED even though i select an account on the dialog?

Here is the end of my logcat running on a OnePlus One 4.4.

Any ideas on what i need to do?

(The Google console is set up with 'net.xx', correct SHA1, Fitness APi enabled.

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
like image 850
Matt Avatar asked Jan 26 '15 16:01

Matt


1 Answers

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.

like image 150
TofferJ Avatar answered Sep 30 '22 14:09

TofferJ