react-native-fitness
react-native-fitness copied to clipboard
Error screen on android
On iOS it is working fine without issue
on android, I can make it work
React native : 0.62 "@ovalmoney/react-native-fitness": "^0.4.0",
I did this step (I think correctly) Get an OAuth 2.0 Client ID as explained at https://developers.google.com/fit/android/get-api-key
When I try to call isAuthorized, or requestPermission
Any idea ?
I got the same error and resolve it by using direct values for kind permission like this: const permissions = [ {kind: 0, access: 0}, {kind: 2, access: 0}, {kind: 0, access: 1}, {kind: 2, access: 1} ];
All the values that we can use are : export declare enum PermissionKind { Steps = 0, Distances = 1, Calories = 2, HeartRate = 3, Activity = 4, SleepAnalysis = 5, }
export declare enum PermissionAccess { Read = 0, Wrtie = 1, }
@GuleriaAshish thanks. You made my morning.. and my day ... and my week 👍
You welcome @batical ,
Are you currently working on it? Actually i am facing an issue that when i call getCalories it returns me an empty array. So have you face this thing too?
I quickly test If it was not crashing. have to to more implementation and test on real device.
I am only using getSteps in my case. will come back after more test
Have you get a proper result in case of using getSteps?
I tested with a internal release on my staging app.
I use Huawei P20 for testing. I install google fit app. I add a activity with some steps and was able to fetch them in my app
@batical @GuleriaAshish since you managed to run it on Android, can you see if I am missing something? It just shows the modal to choose account, but no option to choose permissions after that
https://github.com/OvalMoney/react-native-fitness/issues/48#issuecomment-688761194
I got the same error and resolve it by using direct values for kind permission like this: const permissions = [ {kind: 0, access: 0}, {kind: 2, access: 0}, {kind: 0, access: 1}, {kind: 2, access: 1} ];
All the values that we can use are : export declare enum PermissionKind { Steps = 0, Distances = 1, Calories = 2, HeartRate = 3, Activity = 4, SleepAnalysis = 5, }
export declare enum PermissionAccess { Read = 0, Wrtie = 1, }
@PaLaMuNDeR, Please refer this solution of how to use permissions const.