matinzd / react-native-health-connect

React native library for health connect (Android only)
http://matinzd.github.io/react-native-health-connect
MIT License
196 stars 41 forks source link

Empty Active Calories burned and Total Calories burned #80

Open AhmedFarazQaimkhani opened 5 months ago

AhmedFarazQaimkhani commented 5 months ago

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:

LeonNissen commented 4 months ago

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.