[英]How to get daily step count and active calories from google fitness store via Fitness REST API
I am using nodejs and Google's official "googleapis" module. 我正在使用nodejs和Google的官方“ googleapis”模块。 I am unable to get any value field from any data source. 我无法从任何数据源获取任何值字段。
var count = 0;
async.eachSeries(dataSources, function (source, nextSource) {
count++;
console.log(count, source.dataStreamId);
console.log('------------------------------------------------------------------------------------------------------------------------------');
fitness.users.dataSources.datasets.get({
dataSourceId: encodeURI(source.dataStreamId),
datasetId: new Date('2016-01-01').getTime() + '-' + new Date().getTime(),
userId: "me"
}, function (err, data) {
if (err) {
console.log(err);
return nextSource(err);
}
console.log("Data Set");
console.log(data);
nextSource(null);
});
}, function nextSource(err) {
if (err) {
return nextTask(err);
}
nextTask(null, 'OK')
});
All I get in response is something like: 我得到的回应是:
{ minStartTimeNs: '1451606400000',
maxEndTimeNs: '1455532058239',
dataSourceId:
'derived:com.google.step_count.delta:com.google.android.gms:estimated_steps'
}
I had the same problem, but find the sollution. 我遇到了同样的问题,但是找到了解决方法。
"minStartTimeNs: '1451606400000', maxEndTimeNs: '1455532058239'" “ minStartTimeNs:'1451606400000',maxEndTimeNs:'1455532058239'”
They are not in the correct format, the api need epoch time in NANOSECOND (19 number), so its need to 1451606400000000000 and 1455532058239000000 它们的格式不正确,api需要以NANOSECOND(19号)为起始时间,因此它需要1451606400000000000和1455532058239000000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.