Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error screen on android #68

Open
batical opened this issue Sep 1, 2020 · 8 comments
Open

Error screen on android #68

batical opened this issue Sep 1, 2020 · 8 comments

Comments

@batical
Copy link

batical commented Sep 1, 2020

On iOS it is working fine without issue

on android, I can make it work
Capture d’écran 2020-09-01 à 16 41 01

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
Capture d’écran 2020-09-01 à 16 46 00

Any idea ?

@GuleriaAshish
Copy link

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,
}

@batical
Copy link
Author

batical commented Sep 2, 2020

@GuleriaAshish thanks. You made my morning.. and my day ... and my week 👍

@GuleriaAshish
Copy link

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?

@batical
Copy link
Author

batical commented Sep 2, 2020

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

@GuleriaAshish
Copy link

Have you get a proper result in case of using getSteps?

@batical
Copy link
Author

batical commented Sep 2, 2020

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

@PaLaMuNDeR
Copy link

@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

#48 (comment)

@GuleriaAshish
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants