google-apigoogle-fitoauth2-playgroundgoogle-fit-sdk

Unable to get exact steps as shown on Google fit app


I tried all sources listed in Datasource api of google fit. However, I was unable to get exact match for number of steps shown on fit app. The response returned by APIs is cumbersome to use. Could have been more specific as in which API to be used when. Also, i walked 91 steps 15 mins before. However, still I am not able to get that data after making API request. It just shows stale data. Not sure if it supports realtime. I am having excellent wifi connection, but seems data has not yet been uploaded to google cloud. Fit app does how 91 steps though.

Following is my api request:

GET /fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:com.google.android.gms:estimated_steps/datasets/1429848000000000000-1429906530000000000 HTTP/1.1

Summation of the result does not match data displayed for todays steps on Google Fit App


Solution

  • In google doc. said

    To record fitness data, use the Recording API to create a subscription for each data type you want to record.
    

    Use Fitness.RecordingApi.subscribe to subscribe data. Then use Fitness.HistoryApi.readData or Fitness.HistoryApi.readDailyTotal to read. Or you can use Sensor API to monitor step change.