0

I am using GoogleFit API to fetch the data I have added in the Gooogle Fit app, but it takes around 30 mins or so to get that data reflected in the API response.

enter image description here

API: https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate

Request Body


{
  "aggregateBy": [{
    "dataTypeName": "com.google.blood_glucose"
  },
  {
    "dataTypeName": "com.google.blood_pressure"
  },
  {
    "dataTypeName": "com.google.heart_rate.bpm"
  }],
  "startTimeMillis": 1645446600000,
  "endTimeMillis": 1645533000000
}


Response Body


{
    "bucket": [
        {
            "startTimeMillis": "1645446600000",
            "endTimeMillis": "1645533000000",
            "dataset": [
                {
                    "dataSourceId": "derived:com.google.blood_glucose:com.google.android.gms:merged",
                    "point": []
                },
                {
                    "dataSourceId": "derived:com.google.blood_pressure:com.google.android.gms:merged",
                    "point": []
                },
                {
                    "dataSourceId": "derived:com.google.heart_rate.bpm:com.google.android.gms:merge_heart_rate_bpm",
                    "point": []
                }
            ]
        }
    ]
}


OVP10
  • 3
  • 2
Sanjay Naik
  • 264
  • 1
  • 4
  • 23
  • I am not sure what your question is? Do you want to know why this occurs or how to prevent it? – Neele22 Feb 23 '22 at 09:52
  • @Neele22 question is how can i avoid delays in getting data reflected in response? – Sanjay Naik Feb 23 '22 at 10:08
  • The delay is huge after inserting it to the Fit Store. It should be reflected right away. In my experience there is always a 1 min elay whenever I want to pull data after inserting. Try to compare the fetch speed using OAuth Playground if you get the same delay then possibly there’s something wrong with REST. Your phone or app will sync when they’re connected to Wifi. If your rest api shows different info you may need to wait for them to sync. Syncing only happens occasionally and it helps your battery to last longer. – Arel Guatno Jul 08 '22 at 10:21

0 Answers0