-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
I am not getting excercise distance and calories burned #173
Comments
Are you able to show more details on the query you're making? |
I found a "workaround" (it might be the permanent fix depending if they change this). For calories: async getActivityCalories(startTime, endTime) {
try {
const response = await readRecords('TotalCaloriesBurned', {
timeRangeFilter: {
operator: 'between',
startTime: startTime,
endTime: endTime,
},
ascendingOrder: false,
});
const activityRecord = response.records[0];
console.log(activityRecord);
const activityKcal = activityRecord?.energy?.inKilocalories || 0;
return Math.round(activityKcal);
} catch (error) {
console.error(
'Error reading TotalCaloriesBurned from Health Connect:',
error,
);
return null;
}
} For distance: async getActivityDistance(startTime, endTime) {
try {
const response = await readRecords('Distance', {
timeRangeFilter: {
operator: 'between',
startTime: startTime,
endTime: endTime,
},
ascendingOrder: false,
});
const activityRecord = response.records[0];
console.log('Registro distancia');
console.log(activityRecord);
const activityMeters = activityRecord?.distance?.inMeters || 0;
return Math.round(activityMeters);
} catch (error) {
console.error(
`Error reading Distance fromHealth Connect:`,
error,
);
return null;
}
} Edit: add distance and fix typos |
hey @raulzc3 r when I use ActiveCaloriesBurned, I get empty! I'm confused |
Have you all checked if data is present in Google Health Connect app? Are Google Fit and Health Connect sync enabled? |
I am using react native health connect i want to get the data of activity that i have done in the day
I am not able to get the distance covered in particular activity and also not getting the calories that is burned in particular activity
I am only getting this much of data previously i was using react native google fit and in that i was able to get the distance and calories burned as wellreact-native-health-connect version - 3.2.1
The text was updated successfully, but these errors were encountered: