OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
343 stars 68 forks source link

Android promises not resolving #31

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi, Thanks you for the library which works flawlessly on iOS. I am encountering an issue with the android part : whenever I try to call Fitness.getSteps(opt) or Fitness.getDistance(opt), the promises created won't resolve nor reject.

I made sure that my SHA1 is properly authorized through the Google Fitness API & co (as other functions such as Fitness.isAuthorized() properly works).

I'm on RN 0.59.10 with the library at 0.2.4

Francesco-Voto commented 4 years ago

Hi @lblois,

I will check as soon as possibile

ghost commented 4 years ago

Hi @Francesco-Voto , thanks for the support, did you get the time to check ?

Francesco-Voto commented 4 years ago

Can you try with the last release? (0.3.0)

antoinedelp commented 4 years ago

Hi @Francesco-Voto, thanks for the package! I am experiencing the same issue as @lblois on 0.3.0 : promises are just left hanging. It works fine on iOs and I managed to choose my Google account with Fitness.isAuthorized()

Francesco-Voto commented 4 years ago

Hi @antoinedelp,

Can I ask if you also see a possible pick for the permissions you would like to authorise on Android also? It should happen after you select your account

antoinedelp commented 4 years ago

The permissions are the following:

[{ kind: Fitness.PermissionKind.Step }, { kind: Fitness.PermissionKind.Distance }])

I authorized both permissions successfully.

Regarding my problem, I found the solution: I was simply passing an incorrect startDate. Once corrected, the function works as expected!

Francesco-Voto commented 4 years ago

Thank you for the reply! Maybe a better error can be useful.