react-native-health-connect icon indicating copy to clipboard operation
react-native-health-connect copied to clipboard

Reading RestingHeartRate return an empty array

Open cjae opened this issue 1 year ago • 4 comments

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)

cjae avatar May 30 '24 17:05 cjae

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 WhatsApp Image 2024-09-13 at 15 00 07

heritvithalani19 avatar Sep 13 '24 09:09 heritvithalani19

@matinzd please help us here, It's very old issue

heritvithalani19 avatar Sep 13 '24 09:09 heritvithalani19

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?

matinzd avatar Sep 13 '24 10:09 matinzd

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

kinjalik avatar Jun 15 '25 20:06 kinjalik