health_kit_reporter icon indicating copy to clipboard operation
health_kit_reporter copied to clipboard

HKMetadataKeySyncIdentifier / HKMetadataKeySyncVersion are not updated when passed in Quantity.metadata

Open umangsh opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Is it possible to write HKCumulativeQuantitySample values? For instance, I'd like to write QuantityType.dietaryEnergyConsumed values per day. Sample code:

  final now = DateTime.now();
  final lastMidnight = DateTime(now.year, now.month, now.day);
  const harmonized = QuantityHarmonized(100, 'kcal', null);
  final steps = Quantity(
    '',
    QuantityType.dietaryEnergyConsumed.identifier,
    lastMidnight.millisecondsSinceEpoch,
    now.millisecondsSinceEpoch,
    null,
    SourceRevision(...),
    harmonized,
  );
  await HealthKitReporter.save(steps);

Currently, when data is saved this way, calorie values are split per hour in apple health. In this example, 100 calories are added at 12 noon, and apple health displays (100/12) calories consumed every hour (midnight - 1, 1-2, ... )

Describe the solution you'd like Cumulative daily consumption shown as a single data point.

umangsh avatar Jun 22 '22 23:06 umangsh