Google Fit API活动历史记录 [英] Google Fit API Activity History

查看:76
本文介绍了Google Fit API活动历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与Google Fit集成的应用程序.要求之一是显示用户最喜欢的活动(最频繁),即骑自行车.我认为可以通过历史记录 API来完成,但是我不确定如何收集所有活动,以便可以计算出最常见的活动.

I have an app that integrates with Google Fit. One of the requirements is display a users favorite activity (most frequent) i.e.: 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.

有人知道该怎么做吗?

推荐答案

您可以查看以下文档:以获取用户最频繁的活动.首先,您需要通过创建订阅来读取健身历史记录中的数据您想要记录的每种健身数据类型.这使您的应用程序可以与其他设备上的数据同步,还可以在设备上被动记录数据.然后创建一个 DataReadRequest 实例.您可以在文档中看到示例代码.

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. 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.

这篇关于Google Fit API活动历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆