flutter-plugins
flutter-plugins copied to clipboard
[Health 6.0.0] Incorrect dataType for Swimming activity pulled from Google Fit
Remember to specify the plugin name in the title!
Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
- Device: Samsung Galaxy S10
- OS: Android Latest
Description
Swimming activity on Google Fit always pulled as double activities with the same value, the first one as DISTANCE_DELTA and the other one is WORKOUT - OTHER.
// First activity
I/flutter (29481): HealthActivity -
I/flutter (29481): value: 800.0,
I/flutter (29481): unit: METER,
I/flutter (29481): dateFrom: 2024-10-24 09:18:00.000,
I/flutter (29481): dateTo: 2024-10-24 09:48:00.001,
I/flutter (29481): dataType: DISTANCE_DELTA,
I/flutter (29481): platform: PlatformType.ANDROID,
I/flutter (29481): deviceId: SP1A.210812.016,
I/flutter (29481): sourceId: ,
I/flutter (29481): sourceName: com.google.android.apps.fitness
// Second activity
I/flutter (29481): HealthActivity -
I/flutter (29481): value: workoutActivityType: OTHER,
I/flutter (29481): totalEnergyBurned: 249,
I/flutter (29481): totalEnergyBurnedUnit: KILOCALORIE,
I/flutter (29481): totalDistance: 800,
I/flutter (29481): totalDistanceUnit: METER,
I/flutter (29481): unit: NO_UNIT,
I/flutter (29481): dateFrom: 2024-10-24 09:18:00.000,
I/flutter (29481): dateTo: 2024-10-24 09:48:00.000,
I/flutter (29481): dataType: WORKOUT,
I/flutter (29481): platform: PlatformType.ANDROID,
I/flutter (29481): deviceId: SP1A.210812.016,
I/flutter (29481): sourceId: ,
I/flutter (29481): sourceName: com.google.android.apps.fitness
On top of that, the dateTo has .001 millisecond different. can it be fetched as single data with a correct dataType?
To Reproduce
Fetch data as usual
List<HealthActivity> healthPoints =
(await health.getHealthDataFromTypes(
now.subtract(Duration(days: 30)),
now,
HealthRecord.recordClassTypes,
))
.map((e) => e.activity)
.toList();
healthPoints.removeWhere((e) => e.distance < 0.1);
healthPoints.sort((a, b) => b.dateTo.compareTo(a.dateTo));
print('${healthPoints}');
Expected behavior
Doubled data should be pulled as single data with a correct dataType