1

我们有几个客户报告了此类问题,例如,用户在 2021 年 11 月 17 日有 1,361 步,但在 2021 年 11 月 18 日有 0 步,但谷歌的应用程序“google fit”在 11/17 显示 149 步和 11/18 的 1,212 步。

我们阅读日志以查看如下数据点:start=Wed Nov 17 23:34:17 PST 2021,end=Thu Nov 18 19:57:49 PST 2021,name=com.google.step_count.delta,fields=[steps (i)] 长达1天以上。

问题:

  1. google 的应用程序 google fit 准备步骤如何,它使用的方式与此处的文档相同吗? https://developers.google.com/fit/scenarios/read-daily-step-total 还是使用其他方式?或者最近 google fit 有算法更新?因为我们之前没有看到这个问题。
  2. 我们尝试了一个按小时计算并求和步骤的解决方案,这个问题消失了,但这不是一个好的解决方案,它需要更多时间,24 倍数据,需要更多内存。有没有很好的解决方案来避免这个问题?

代码:

    val estimatedStepsDelta = DataSource.Builder()
      .setDataType(DataType.TYPE_STEP_COUNT_DELTA)
      .setType(DataSource.TYPE_DERIVED)
      .setStreamName("estimated_steps")
      .setAppPackageName("com.google.android.gms")
      .build()

    return DataReadRequest.Builder()
      .setTimeRange(startTimeEpochSeconds, endTimeEpochSeconds.coerceAtLeast(startTimeEpochSeconds + 1), TimeUnit.SECONDS)
      .aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
      .aggregate(estimatedStepsDelta, DataType.AGGREGATE_STEP_COUNT_DELTA)
      .aggregate(DataType.TYPE_MOVE_MINUTES, DataType.AGGREGATE_MOVE_MINUTES)
      .bucketByTime(1, TimeUnit.DAYS)
      .enableServerQueries()
      .build()
4

0 回答 0