flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

health 10.2.0 isManualEntry always false

Open LorisTrainect opened this issue 10 months ago • 2 comments

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

  • Device: Samsung A70 (real device)
  • OS: Android 11

Describe the bug

I have done several tests by changing the value of includeManualEntry and then printing the data points, includeManualEntry seems to work correctly and excludes the values I manually added on google fit. However when it is true, the values I added manually are marked as false by isManualEntry. At the moment I have only tried it on google fit but I wanted to point this out, the documentation also about these parameters is very lacking so I don't even know if this is correct behavior because it is a limitation of google fit or not.

  List<HealthDataPoint> stepsList = await health.getHealthDataFromTypes(
              startTime:  dateStart,
              endTime: now,
              types: [HealthDataType.STEPS],
              includeManualEntry: true
          );

          for(HealthDataPoint stepsData in stepsList){

             print("Steps:");
             print(stepsData.value);
             print(stepsData.isManualEntry);
             print(stepsData.dateFrom);
          }

To Reproduce

Using google fit add steps and print the isManualEntry value

Expected behavior

isManualEntry value is true for the data point i have added

Actual behavior

isManualEntry value is always false

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Versione 10.0.22631.3374], locale it-IT) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.5) [√] Android Studio (version 2023.2) [√] VS Code, 64-bit edition (version 1.70.0) [√] Connected device (5 available) [√] Network resources

• No issues found!

LorisTrainect avatar Apr 04 '24 10:04 LorisTrainect

Did you find the solution?

Amrazyan avatar Jun 14 '24 14:06 Amrazyan

No actually not, it would be useful for us to take only the data not manually added but given this problem it is not possible and we have not found solutions

LorisTrainect avatar Jun 14 '24 15:06 LorisTrainect

I have the same problem, i need health connect to give me the steps that were not manually added to google fit

George-nacouzi avatar Jul 17 '24 09:07 George-nacouzi

Issue still not solved and probably won't be solved in the next version as the last commits didn't fix it. The plugin still not using the [recordingMethod] from HC API

var dataPoints = dataSet.dataPoints if (!includeManualEntry) { dataPoints = dataPoints.filterIndexed { _, dataPoint -> !dataPoint.originalDataSource .streamName .contains( "user_input" ) }

inochiconcept avatar Aug 13 '24 16:08 inochiconcept

I have opened a PR (#1023) to attempt to resolve this issue for Health Connect (as we are removing Google Fit support as of version 11.0.0) by providing you with the RecordingMethod from the record metadata.

I would appreciate if you could test it out.

However, for us to know whether a record is manually added or not, the app that writes the data needs to include it as part of the metadata. Regarding filtering out manually added steps, I have noticed that steps manually added to Google Fit are written with Metadata.RECORDING_METHOD_UNKNOWN, and therefore I'm not sure how to differentiate the two types of steps. If you have any ideas I would love to hear them.

SlimShadyIAm avatar Aug 23 '24 11:08 SlimShadyIAm