Trying to create a step tracking application, using ReactJS, where users can log in and compete one ageist the other, collect points, level up etc. Main information about steps should be taken from Google Fit API. The problem is that for some reason I keep getting empty array of points (There were some steps generated last week so it shouldn't be empty).
Response from API:
{
"minStartTimeNs": "100000",
"maxEndTimeNs": "1679904795000000",
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_stepsltas",
"point": []
}
My request:
const listSteps = async () => {
let response;
try {
const now = Date.now();
response = await gapi.client.fitness.users.dataSources.datasets.get({
userId: "me",
dataTypeName: "com.google.step_count.delta",
datasetId: `100000-${now}000000`,
dataSourceId: "derived:com.google.step_count.delta:com.google.android.gms:estimated_stepsltas",
});
console.log("res", response);
} catch (err) {
console.log(err.message);
return;
}
};
I've tried reading the Google Fit documentation, thought maybe the dataSourceId
is wrong. Trued getting full dataSources
object, to check if there is some kind of steps related data in there. No luck... Any ideas on what I'm doing wrong and why this might be happening?