Reputation: 21
While using the Google Fit Rest API for the fitness activities, It gives me the data of the previous days with appropriate step count but not able to gives the current day's count. Even in my mobile, Google Fit sync process was running properly and my internet was running good.
If I force sync(manually) then it can start to give the current day's step count and other activities data. Otherwise, It can only show the data around before 9 o'clock(or daily first sync cycle). After that, It can only update the step count on the next day with the same time frame in API response.
Following I have shared the API details with required parameters:
HTTP method : POST
Request URL : https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate
Request body :
{
"aggregateBy": [{
"dataTypeName": "com.google.step_count.delta",
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"
}],
"bucketByTime": { "durationMillis": 86400000 },
"startTimeMillis": 1559154600000,
"endTimeMillis": 1559241000000
}
Response :
{
"bucket": [
{
"startTimeMillis": "1559154600000",
"endTimeMillis": "1559241000000",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1559181787309598125",
"endTimeNanos": "1559183772877349957",
"dataTypeName": "com.google.step_count.delta",
"originDataSourceId": "raw:com.google.step_count.cumulative:Realme:RMX1833:355d9abc461f5254:STEP_COUNTER",
"value": [
{
"intVal": 233,
"mapVal": []
}
]
}
]
}
]
}
]
}
Current, It can show only 233 steps count from morning while Google Fit application show me the 4674 steps. How can I get the same figure as Google Fit App can display?
Upvotes: 0
Views: 968