最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Health Connect BodyTemperatureRecord, OxygenSaturationRecord, BloodGlucoseRecord don't have an aggregate metri

programmeradmin1浏览0评论

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 and HeartRateRecord.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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论