react-native-health-connect
react-native-health-connect copied to clipboard
Reading RestingHeartRate return an empty array
Describe the bug
I'm getting empty Resting Heart Rate in my app, while in Samsung health app I have both heart rate and resting heart rate.
To Reproduce
const timeRangeFilter: TimeRangeFilter = {
operator: 'between',
startTime: startTime,
endTime: endTime,
};
const heartRateData = await readRecords('RestingHeartRate', {
timeRangeFilter,
dataOriginFilter,
});
console.log({ heartRateData }); // Empty Array
Expected behavior
Should return an array of heart rate objects
Environment:
- Health Connect Version: 2.0.3
- React Native Version: 0.74.1
- New architecture enabled: Yes
- Using Expo: Go (Development Build)
Hi @matinzd I tired to fetch HeartRate using SKD version 3.1.0 and it's return empty array each time,
await readRecords('HeartRate', {
timeRangeFilter: {
operator: 'between',
startTime: '2024-09-13T09:10:00.000Z',
endTime: '2024-09-13T09:14:00.000Z',
},
ascendingOrder: true,
});
Health connect is already connected and also data is available for specific time zone
@matinzd please help us here, It's very old issue
Your issue is different than what is mentioned by the OP. You are using HeartRate record but the issue is about RestingHeartRate. Please open a separate issue for that.
Have you both added necessary permissions?
Hello there, found this thread while troubling with Health Connect. I'm facing the same issue with Health Connect. However, I guess it's not an issue of React Native related stuff, but a bug or feature of Health Connect, cuz I'm working with native Android app in Kotlin instead of React Native and Zepp instead of Samsung Health
Firstly I'd recommend to play with Health Connect Toolbox (https://goo.gle/health-connect-toolbox), a tool by Google to debug HC. It shows much more info about entries
Second try to capture an entire day (from 00:00 to 00:00) using your code or toolbox. In my case that was the only way to obtain any HeartRate records. Also, in my case it seems like an entire day written to one record with all BPMs as samples (one record may contain multiple samles).
So, I suspect it requires to an entire record time range (i.e. from time of first sample up to the time of last samlpe) fit into provided timeRangeFilter