简体   繁体   English

Google Fit API 活动历史记录

[英]Google Fit API Activity History

I have an app that integrates with Google Fit.我有一个与 Google Fit 集成的应用程序。 One of the requirements is display a users favorite activity (most frequent) ie: bicycling.要求之一是显示用户最喜欢的活动(最频繁),即:骑自行车。 I assume it would be done through the History API, but I'm not sure how to gather all activities so I can calculate the most common one.我认为这将通过History API 完成,但我不确定如何收集所有活动,以便计算最常见的活动。

Anybody have any idea how to go about doing that?有人知道如何去做吗?

You can check this documentation: Work with the Fitness History to get most frequent activity of the user.您可以查看此文档: 使用健身历史记录获取用户最频繁的活动。 First, you need to read data from the fitness history by creating a subscription for each fitness data type you'd like to record.首先,您需要通过为要记录的每种健身数据类型创建订阅来从健身历史记录中读取数据。 This enables your app to sync with data from other devices, and also allows for the passive recording of data on the device.这使您的应用程序能够与来自其他设备的数据同步,并且还允许在设备上被动记录数据。 Then create a DataReadRequest instance.然后创建一个DataReadRequest实例。 You can see the sample code in the documentation.您可以在文档中查看示例代码。

The data request can specify multiple data types to return, effectively combining multiple data queries into one call.数据请求可以指定多种数据类型返回,有效地将多个数据查询合并为一个调用。 With this, you can compare which activity the user used most.有了这个,您可以比较用户最常使用的活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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