Giter Club home page Giter Club logo

Comments (12)

StasDoskalenko avatar StasDoskalenko commented on September 3, 2024

@PierreCavalet it's common issue when you miss something from here

  1. In order for the library to work correctly, you'll need following SDK setups:

Android Support Repository
Android Support Library
Google Play services
Google Repository
Google Play APK Expansion Library

  1. In order for your app to communicate properly with the Google Fitness API, you need to provide the SHA1 sum of the certificate used for signing your application to Google. This will enable the GoogleFit plugin to communicate with the Fit application in each smartphone where the application is installed. https://developers.google.com/fit/android/get-api-key

from react-native-google-fit.

PierreCavalet avatar PierreCavalet commented on September 3, 2024

@StasDoskalenko I already provided the SHA1 sum to generate the clientID of the certificate which I directly put in the MainApplication.java like so:

...
new GoogleFitPackage("clientID....apps.googleusercontent.com"),
...

I've used the following command to generate it (mac OS):

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

I then created new credentials for an Oauth client ID and submitted the SHA1 fingerprint and package name which gave me the clientID that I used in the MainApplication.java. Is there something wrong with my procedure ? Note that I can retrieve my google fit data on my phone (in debug) which seems to indicate that it's somehow working, but maybe I missed something else.

Any idea ?

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on September 3, 2024

@PierreCavalet yes. You shouldn't pass clientID to GoogleFitPackage constructor.
Just use it like in installation guide. new GoogleFitPackage(BuildConfig.APPLICATION_ID)

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on September 3, 2024

In any case you can see the reason within:
GoogleFit.onAuthorizeFailure((error) => { console.log('failure', error); });

from react-native-google-fit.

PierreCavalet avatar PierreCavalet commented on September 3, 2024

I switched for new GoogleFitPackage(BuildConfig.APPLICATION_ID)

I get the error:
"ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{f40b858: android.os.BinderProxy@6ca86bc}, message=null}"

Which seems to be an error when the user did not authorized the application, but what is weird is that I'm in the authorization process.

I'm still getting this error before I pick the google account, so obviously I'm not signed in yet

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on September 3, 2024

Actually, it means that you missed something from Google Docs. Please try to follow these instructions https://developers.google.com/fit/android/get-api-key really carefully.

from react-native-google-fit.

PierreCavalet avatar PierreCavalet commented on September 3, 2024

I'm no android expert, I don't really understand what I did wrong.

(Note that I didn't do the release key part since I'm in debug, is there something wrong with that ?)

I got my SHA-1 fingerprint from the ~/.android/debug.keystore and generated my clientID with the fingerprint and package name.

from react-native-google-fit.

PierreCavalet avatar PierreCavalet commented on September 3, 2024

Hi again,

I just wanted to provide more information in case this can help. Maybe I am wrong, but it seems that the api-key process works, because with an other keystore, it was not working (which is normal).

I went through the process again for the new keystore and I can now retrieve my data with this one. So it seems to work. The authorization also works normally on the "success scenario". The only thing which is not working seems to be the onAuthorizeFailure which is still trigger even when it works.

from react-native-google-fit.

ernestasromeika avatar ernestasromeika commented on September 3, 2024

I have the exact same issue, GoogleFit.onAuthorize() is triggered at the exact same time as GoogleFit.authorize() is called, before user even selects his google profile. Results in an error message: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{2438a5: android.os.BinderProxy@d4c947a}, message=null}.

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on September 3, 2024

@ernestasromeika statusCode=SIGN_IN_REQUIRED means that you've missed something from https://developers.google.com/fit/android/get-api-key

from react-native-google-fit.

PierreCavalet avatar PierreCavalet commented on September 3, 2024

@ernestasromeika did you solve your problem ?

btw I suppose you meant that the onAuthorizeFailure callback is called at the same time as GoogleFit.authorize() is called ?

from react-native-google-fit.

glocore avatar glocore commented on September 3, 2024

I have no idea of how, but for some reason the following seems to work for me:
Inside node_modules > react-native-google-fit > android > build.gradle, scroll all the way to the bottom and replace the version numbers of play-services-auth and play-services-fitness to +, similar to how it is for react-native. Here's what it'll look like in the end:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.facebook.react:react-native:+'
    compile 'com.google.android.gms:play-services-auth:+'
    compile 'com.google.android.gms:play-services-fitness:+'
}

from react-native-google-fit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.