【问题标题】:Google FIT Api history data retrieved does not merge steps by default检索到的 Google FIT Api 历史数据默认不合并步骤
【发布时间】:2022-06-30 21:19:44
【问题描述】:

所以要检索步数,我使用以下代码:

fun getFitnessData(startTime: Long, endTime: Long): DataReadRequest {
    return DataReadRequest.Builder()
        .aggregate(DataType.AGGREGATE_STEP_COUNT_DELTA)
        .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
        .bucketByTime(..., TimeUnit.MINUTES)
        .build()
}

这在使用手机完成记录的步数时非常有效,但只要用户也有手表,就会错误地返回步数。

例如,如果用户手机记录了 30 步,那么手表也记录了 30 步,返回的结果是 60 步,但我希望手机/手表在 th 中返回 30 步

【问题讨论】:

    标签: android google-fit


    【解决方案1】:

    数据的合并似乎是预期的行为。根据documentation,将手表和手机的步数合并以获得最完整的步数。合并数据时,手表数据优先于手机数据(优先级避免计算重复步骤)。当您读取数据类型时,Google Fit 平台会返回此准确的合并信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      • 2016-06-05
      相关资源
      最近更新 更多