matinzd/react-native-health-connect

Empty Active Calories burned and Total Calories burned

AhmedFarazQaimkhani opened this issue · 5 comments

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.