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

Able to filter out manually added steps

Open junedomingo opened this issue 2 years ago • 10 comments

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

junedomingo avatar Nov 13 '23 06:11 junedomingo

same issue, any updates?

shuraman69 avatar Dec 11 '23 09:12 shuraman69

Hello, hoping for news on this too!

ghag75 avatar Dec 20 '23 18:12 ghag75

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 avatar Dec 20 '23 20:12 matinzd

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 avatar Dec 20 '23 20:12 matinzd

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

matinzd avatar Dec 20 '23 22:12 matinzd

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.

junedomingo avatar Dec 21 '23 13:12 junedomingo

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 ?

mhjianu94 avatar Jul 16 '24 14:07 mhjianu94

@mhjianu94 any update on this ?

SaGaR1084 avatar Aug 17 '24 12:08 SaGaR1084

Hello, first thank you for the lib @matinzd ! Does anyone have any news on this subject? For my part, recordingMethod is always set to 0 too, whether it's an activity auto-added or a manual addition.

gwencode avatar Nov 21 '24 10:11 gwencode

Hello, I found that Google Fit is aware of the problem but they indicated in January/February 2024 that they do not plan to add recordingMethod information for the time being : https://issuetracker.google.com/issues/317432133

The team has confirmed that recordingMethod is currently only specified for exercise sessions. At this time, there aren't plans to document recordingMethod for Steps.

Fit does not support this field for steps currently and there is no plan in the future to add support.

I have opened a new issue to try to have more chances than the previous one but I'm not too hopeful : https://issuetracker.google.com/issues/380095416

gwencode avatar Nov 21 '24 10:11 gwencode