react-native-health-connect
react-native-health-connect copied to clipboard
Empty Active Calories burned and Total Calories burned
Describe the bug I'm getting empty Active Calories burned and Total Calories burned in my app, while in Samsung health app I have calories.
To Reproduce const startOfDay = new Date(); startOfDay.setHours(0, 0, 0, 0); // Set to the beginning of the day
const endOfDay = new Date(); endOfDay.setHours(23, 59, 59, 999); // Set to the end of the day
await readRecords("TotalCaloriesBurned", { timeRangeFilter: { operator: "between", startTime: startOfDay.toISOString(), endTime: endOfDay.toISOString(), }, }).then((result) => { console.log("TotalCaloriesBurned Retrieved record: ", JSON.stringify({ result }, null, 2)); });
await readRecords("ActiveCaloriesBurned", {
timeRangeFilter: {
operator: "between",
startTime: startOfDay.toISOString(),
endTime: endOfDay.toISOString(),
},
}).then((result) => {
console.log("ActiveCaloriesBurned Retrieved record: ", JSON.stringify({ result }, null, 2));
});
Expected behavior I need active and total calories
Environment:
- Health Connect Version: 2.0.1
- React Native Version: 0.72.6
- New architecture enabled: Yes
Hi @AhmedFarazQaimkhani
I stumbled across the same 'issue.' However, I discovered that Google Fit, in my case, does not save calories into 'activeCaloriesBurned' but rather into 'totalCaloriesBurned.' Since you have tested both, it might be due to something else. Nonetheless, I recommend testing out with the Health Connect Toolbox if you haven't already, and try reading the values there.
Afterwards, we can better determine if the problem is related to Samsung Health, Health Connect, or this framework.
@LeonNissen @AhmedFarazQaimkhani aI am facing the same problem, it is always empty
Have you all checked if data is present in Google Health Connect app? Are Google Fit and Health Connect sync enabled?
@matinzd I noticed that Fit doesn't seem to grant Health Connect permission for ActiveCaloriesBurned. i tried to use the Health Connect Toolbox to insert ActiveCaloriesBurned, got a successful toast, but the result was still 0
If you are also getting 0 in health connect toolbox as well, then the issue is not related to react native health connect. I can't help you with that.