Android Google Fit onConnectionFailed () SIGN_IN_REQUIRED

I can not get around this problem. I just can't get in.

I am running a sample sample of BasicSensorApi and it just doesn't connect. It seems I get RESULT_CANCELED even though I select an account in a dialog box?

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

Any ideas on what I need to do?

(Google console is configured using "net.xx", SHA1, Fitness APi is configured correctly.

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 
+6
source share
2 answers

If you are not logged in, you will receive a response to GoogleApiClient.OnConnectionFailedListener() with the error displayed in the LogCat message. If you try to solve the problem using result.startResolutionForResult(YourActivity.this, REQUEST_CODE); The account selection dialog will be displayed. It seems to me that you have come so far. It is right?

After you select an account in the dialog box, you need to make another connection attempt from your onActivityResult() activity. Sounds to me like you can skip this code.

On the other hand: if you connect for the first time, you will get another error at that moment. This will display a consent screen. If the user accepts and you make another connection attempt, you must be successfully connected to the API.

+6
source

When I tried to allow this login loop when adding Google Plus to the Google Play services mapping, I had to add additional APIs and OAuth credentials for my Android application to the Google API console .

I already had a marker attribute associated with my Maps API application, but the Google Plus login will return the CANCELED result code until I add the Google Plus API and add the necessary OAuth credentials for these APIs. As soon as it appeared on my API project, my activity result handler began to see OK result codes.

0
source

Source: https://habr.com/ru/post/981561/


All Articles