cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
554 stars 681 forks source link

health 10.2.0 isManualEntry always false #947

Closed LorisTrainect closed 3 months ago

LorisTrainect commented 7 months ago

Device / Emulator and OS

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

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!

Amrazyan commented 5 months ago

Did you find the solution?

LorisTrainect commented 5 months ago

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

George-nacouzi commented 4 months ago

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

inochiconcept commented 3 months ago

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" ) }

SlimShadyIAm commented 3 months ago

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.