问题
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.
Anybody have any idea how to go about doing that?
回答1:
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.
来源:https://stackoverflow.com/questions/39737598/google-fit-api-activity-history