简体   繁体   中英

Can I get real-time data on my steps through Google Fit REST API?

At the moment I need to develop a mobile application that should be a fitness tracker. I am thinking about using REST API instead of Android API, but I don't quite understand how in this case automatic data collection on the steps taken from my device will occur.

I understand that I can request information about the completed steps for some time, for example, for the last month, as shown in the documentation.

But what allows the application in this case to automatically access the "raw" information from the sensors and give it to Google Fit, as it happens in the Android API? And show me my steps in real-time.

At this point, you need 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM