gpt4 book ai didi

google-api-php-client - 如何从 Google Fit REST API(如 Google Fit 应用程序)获取步数?

转载 作者:行者123 更新时间:2023-12-03 15:47:33 26 4
gpt4 key购买 nike

我正在开发一个 PHP 应用程序,该应用程序与 Google Fit API 一起使用来收集每日用户的步数。

我想从“2015 年 1 月 15 日 00:00:00 GMT+0700”到“2015 年 1 月 16 日 00:00:00 GMT+0700”获取我的步数。
- 首先,我得到我所有的数据源。
- 然后,对于数据类型等于“com.google.step_count.delta”的每个数据源,我在上述时间戳之间获取数据集并将返回值相加。

我的代码:https://gist.github.com/daitr-gu/472c4f18522172542cca
我的结果:https://gist.github.com/daitr-gu/1a7e11eb483a657bdc8b

我发现,有很多数据源,它们返回不同的值。而且这些值与我在手机上的 Google Fit 应用程序中看到的值相差太大。

问题:
1. Google Fit 应用程序使用哪个数据源来计算步数?
2. 为什么数据源的值和Google Fit 的值不同?
3. 如何获得 Google Fit 值?

最佳答案

  • Google Fit 应用程序使用哪个数据源来计算步数?

  • Google Fit App 使用estimated_steps 数据源来计算步数。
    DataSourceId: 派生:com.google.step_count.delta:com.google.android.gms:estimated_steps
  • 为什么数据源的值和 Google Fit 的值不同?

  • 每个数据源代表不同的设备/源。我看到你有一个 Sony 智能 watch 和一个 HTC Desire 连接到 Google Fit。您的每个设备都向 Fit 报告合并在一起的值。 Merge_step_deltas 为您提供所有步数计数器的合并流。 Estimated_steps 还考虑了事件,并在没有事件时估计步数。
  • 如何获得 Google Fit 值?

  • REST API 只能访问已同步到后端的数据。
    要获得与 Google Fit 相同的值,请阅读estimated_steps 数据源。它应该与您在 https://fit.google.com/ 上看到的相同.设备可能具有尚未同步到服务器的最新值。我们正在努力使同步和跨平台体验更加无缝。

    -- Google Fit 团队的工程师。

    关于google-api-php-client - 如何从 Google Fit REST API(如 Google Fit 应用程序)获取步数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27998823/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com