4

I have been fighting this ridiculous api for a while now. Checked all over SO and couldn't find any useful help for the REST API, looks like Android has it much better at this point.

Anyways, I am trying to figure out the total distance traveled each day (separately) for different activities like biking, running, etc.

I was able to aggregate data for step count. With the following request POSTed to https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate

{
  "aggregateBy": [
    {
      "dataTypeName": "com.google.step_count.delta",
      "dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"
    }
  ],
  "bucketByTime": { "durationMillis": 86400000 }, // 1 day per bucket
  "startTimeMillis": startTime.getTime(),
  "endTimeMillis": endTime.getTime()
}

I know that I can get all distance by using com.google.distance.delta, but I want to filter to a specific ActivityType. Any suggestions would help this headache!

Andrew McOlash
  • 1,562
  • 1
  • 9
  • 9

0 Answers0