I'm trying to read aggregate quantities for body temperature, oxygen saturation and blood glucose from Health Connect. The example in the official docs explains how to do this for steps:
val response =
healthConnectClient.aggregateGroupByPeriod(
AggregateGroupByPeriodRequest(
metrics = setOf(StepsRecord.COUNT_TOTAL),
timeRangeFilter = TimeRangeFilter.between(startTime, endTime),
timeRangeSlicer = Period.ofMonths(1)
)
)
The AggregateGroupByPeriodRequest
requires a Set<AggregateMetric<*>>
. Most data types seem to have one or more corresponding AggregateMetric stored in a static field of the record type, for example:
- steps has
StepsRecord.COUNT_TOTAL
- exercise session has
ExerciseSessionRecord.EXERCISE_DURATION_TOTAL
- calories burned has
TotalCaloriesBurnedRecord.ENERGY_TOTAL
- distance has
DistanceRecord.DISTANCE_TOTAL
- heart rate has
HeartRateRecord.BPM_AVG
,HeartRateRecord.BPM_MAX
andHeartRateRecord.BPM_MIN
...etc.
However I can't find any equivalent metric for BodyTemperatureRecord or OxygenSaturationRecord or BloodGlucoseRecord. They just seems to be missing. So how do you perform an aggregate query on these types?
I'm using the latest Health Connect library 1.1.0-alpha11.
Thanks