我可以通过 Google Fit REST API 获取我步数的实时数据吗?
Can I get real-time data on my steps through Google Fit REST API?
目前我需要开发一个应该是健身追踪器的移动应用程序。我正在考虑使用 REST API 而不是 Android API,但我不太明白在这种情况下如何对从我的设备采取的步骤进行自动数据收集。
我知道我可以在一段时间内请求有关已完成步骤的信息,例如上个月,如文档中所示。
但是在这种情况下,是什么允许应用程序自动访问来自传感器的 "raw" 信息并将其提供给 Google Fit,就像 Android [=21] 中发生的那样=]?并实时显示我的步数。
此时,你需要Sensor API.
The Sensors API lets you read raw sensor data in your app in real
time. Use this API to:
- List data sources available on the device and on companion devices.
- Register listeners to receive raw sensor data.
- Unregister listeners to stop receiving raw sensor data.
The Sensors API does not automatically store sensor readings in the
fitness store and sensor registrations created with the Sensors API
are not persisted when the system restarts. You typically use the
Recording API to record data in the background with persistent
subscriptions and you use the Sensors API to display or process sensor
readings in real time. In many cases, you use both of these APIs in
your app.
目前我需要开发一个应该是健身追踪器的移动应用程序。我正在考虑使用 REST API 而不是 Android API,但我不太明白在这种情况下如何对从我的设备采取的步骤进行自动数据收集。
我知道我可以在一段时间内请求有关已完成步骤的信息,例如上个月,如文档中所示。
但是在这种情况下,是什么允许应用程序自动访问来自传感器的 "raw" 信息并将其提供给 Google Fit,就像 Android [=21] 中发生的那样=]?并实时显示我的步数。
此时,你需要Sensor API.
The Sensors API lets you read raw sensor data in your app in real time. Use this API to:
- List data sources available on the device and on companion devices.
- Register listeners to receive raw sensor data.
- Unregister listeners to stop receiving raw sensor data.
The Sensors API does not automatically store sensor readings in the fitness store and sensor registrations created with the Sensors API are not persisted when the system restarts. You typically use the Recording API to record data in the background with persistent subscriptions and you use the Sensors API to display or process sensor readings in real time. In many cases, you use both of these APIs in your app.