agencyenterprise / react-native-health

A React Native package to interact with Apple HealthKit
MIT License
799 stars 226 forks source link

To receive HOURLY Step Count Health Data #359

Open Lemiex opened 5 months ago

Lemiex commented 5 months ago

Is your feature request related to a problem? Please describe. Most of the get functions such as getStepCount() only take as input a day Date object for people to get a daily step count. However, I would find it to be extremely beneficial if hourly data is supported, since the Apple Health app presents hourly step count (and other sensor) data during the day. Currently, we have a a loss of data. I find that if i specify an hour in the date for HealthInputOptions, such as

const options: HealthInputOptions = {
            date: new Date("2024-01-25T13:00:00").toISOString(),
            includeManuallyAdded: false,
        };

The step count data ignores the time and only takes in the day, and returns the daily step count.

Describe the solution you'd like It would be great if the get functions took hourly Dates as parameters too, and returns step counts during those hours

For example,

const options: HealthInputOptions = {
            startTime: new Date("2024-01-25T13:00:00").toISOString(),
            startTime: new Date("2024-01-25T17:00:00").toISOString(),
            includeManuallyAdded: false,
        };

Additional context I have also looked into background observers and adding listeners (which doesn't seem to work for most people), however that only provide current hourly/minute-ly data instead of past data.

If anyone knows a workaround please let me know!!! Thank you.

KesoGizmoYoshi commented 5 months ago

I would also be interested in this.

kfchan-git commented 3 months ago

Tried to add unit: 'minute' and it crashed

kourtc commented 1 month ago

interested