I'm developing a PHP application which work with Google Fit APIs to collect daily user's step count.
I want to get my step count from "Jan 15 2015 00:00:00 GMT+0700" to "Jan 16 2015 00:00:00 GMT+0700". - First, I get all my datasources. - Then, with each datasource which have datatype equal to "com.google.step_count.delta", I get datasets between above timestamps and add return values together.
My code: https://gist.github.com/daitr-gu/472c4f18522172542cca
My result: https://gist.github.com/daitr-gu/1a7e11eb483a657bdc8b
I found that, there are many datasources and they returns different values. And the values are too different from what I see in Google Fit app on my phone.
Questions:
1. Which datasource the Google Fit app use to calculate step count?
2. Why there are different between datasources's value and Google Fit value?
3. How can I get the Google Fit value?
Google Fit App uses the estimated_steps data source to calculate step counts. DataSourceId: derived:com.google.step_count.delta:com.google.android.gms:estimated_steps
Each data source represents a different device/source. I see you have a Sony Smart Watch and a HTC Desire connected to Google Fit. Each of your devices reports values to Fit which are merged together. Merge_step_deltas gives you the merged stream of all your step counters. Estimated_steps also takes into account activity, and estimates steps when there are none.
REST API can only access data which has been synced to the backend. To get same values as Google Fit, read estimated_steps data source. It should be the same as what you see on https://fit.google.com/. The device could have latest values which are not yet synced to the server. We are working on making the syncs and the cross-platform experience more seamless.
-- Engineer on Google Fit Team.