matinzd / react-native-health-connect

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

Able to filter out manually added steps #51

Open junedomingo opened 10 months ago

junedomingo commented 10 months ago

Describe the bug First thanks for this library!

Is there a way to filter out manually added steps?

To Reproduce Add activity in Google Fit > Add steps > Save

Reading records

    const records = await readRecords('Steps', {
      timeRangeFilter: {
        operator: 'between',
        startTime: startOfDay(new Date()).toISOString(),
        endTime: endOfDay(new Date()).toISOString(),
      },
    });

    console.log('records', records);

Output

    {
        "count": 1,
        "endTime": "2023-11-13T13:10:01.770Z",
        "metadata": {
            "clientRecordId": null,
            "clientRecordVersion": 0,
            "dataOrigin": "com.google.android.apps.fitness",
            "device": 0,
            "id": "fed4b274-7df5-407a-9244-ceffdfd84fee",
            "lastModifiedTime": "2023-11-13T13:10:17.455Z",
            "recordingMethod": 0
        },
        "startTime": "2023-11-13T12:40:01.769Z"
    }

Expected behavior In recordingMethod should be 3

Screenshots n/a

Environment: n/a

shuraman69 commented 9 months ago

same issue, any updates?

ghag75 commented 9 months ago

Hello, hoping for news on this too!

matinzd commented 9 months ago

As you can see recordingMethod is implemented here thanks to @sauravexodus in this PR. Maybe I need to try updating to the latest native lib but I cannot guarantee that can solve the issue.

matinzd commented 9 months ago

From docs: https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0-alpha06

recordingMethod definitions are public in alpha06 and we are on alpha04.

matinzd commented 9 months ago

Despite upgrading to alpha06, the issue persists. The Health Connect app and all dependencies are up-to-date.

I've decided to temporarily suspend maintenance of this library until a stable version is released by Google.

On a related note, Google Fit is inaccurately reporting a wrong recording method, and the issue is unrelated to this library. I've included the native debug for reference. It might be worthwhile to seek assistance from Google's support. Consider opening an issue on Google's Issue Tracker and referencing the details provided here. The problem could be either with Health Connect or an issue with the proper functioning of Google Fit sync.

For now, let's humor the notion that "unknown" is synonymous with manual entry! 😅

Screenshot 2023-12-20 at 23 04 02
junedomingo commented 9 months ago

Thanks, @matinzd, for taking a look! Actually, even the steps that are auto-added by the app have a 0 value in the recordingMethod. But yeah hopefully, Google will fix this soon. Thanks again.

mhjianu94 commented 2 months ago

Hello @matinzd I just stumbled on this issue myself. I don't seem to find any information from google about this issue with Heatlh Connect. Similar as it was previously reported, recordingMethod is always 0 no mather the source of the data. Both data from fitbit and google fit it is reported as "recordingMethod":0 even if it is from a measuring device or manually imputed.

Any updates on this ?

{ "count":18, "endTime":"2024-07-16T11:32:00Z", "metadata":{ "clientRecordId":null, "clientRecordVersion":0, "dataOrigin":"com.fitbit.FitbitMobile", "device":0, "id":"2e767797-d647-431f-a34c-50c3593a23e3", "lastModifiedTime":"2024-07-16T13:48:16.637Z", "recordingMethod":0 }, "startTime":"2024-07-16T11:31:00Z" },

In the documentation i see the description: "Optional client supplied data recording method to help to understand how the data was recorded." - Does this mean that the clients Google Fit and Fitbit are not providing this data ?

SaGaR1084 commented 1 month ago

@mhjianu94 any update on this ?