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

[Android] Application needs OAuth consent from the user #96

Open
NguyenHoangMinhkkkk opened this issue Feb 26, 2021 · 1 comment
Open

Comments

@NguyenHoangMinhkkkk
Copy link

NguyenHoangMinhkkkk commented Feb 26, 2021

This Error happen with getHeartRate method
while the othes methods are working fine after sign in and allow permissions (permission HeartRate included).


const permissions = [
{
kind: Fitness.PermissionKinds.Steps,
access: Fitness.PermissionAccesses.Read,
},
{
kind: Fitness.PermissionKinds.Calories,
access: Fitness.PermissionAccesses.Read,
},
{
kind: Fitness.PermissionKinds.Distances,
access: Fitness.PermissionAccesses.Read,
},
{
kind: Fitness.PermissionKinds.HeartRate,
access: Fitness.PermissionAccesses.Read,
},
];


let currentDate = new Date();
let start = new Date(2021, 1, 1, 0, 0, 0);
let end = new Date( currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), 23, 59, 59,);

const getHeartRate = () => {
Fitness.getHeartRate({ startDate: start, endDate: end, interval: 'days' })
.then((res) => {
console.log('getHeartRate', res);
})
.catch((e) => {
console.log('error', e);
});
};


Screen Shot 2021-02-26 at 16 09 13
Screen Shot 2021-02-26 at 16 48 51
Screen Shot 2021-02-26 at 16 59 23

@robrechtme
Copy link

I had the same issue, I think the error message you receive from the Google Fit API is incorrect.

For heart rate you also need to request the android.permission.BODY_SENSORS permission. You can do so by using react-native-permissions.

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

2 participants