使用此代码(Node.JS)可以获得一段时间内消耗的卡路里:
request({
method: 'POST',
uri: 'https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate',
headers: {
'Content-Type': 'application/json;encoding=utf-8',
'Authorization': 'Bearer ' + accessToken
},
body: {
aggregateBy: [{
dataSourceId: 'derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended'
}],
bucketByTime: { durationMillis: (endTimeMillis - startTimeMillis) },
startTimeMillis: startTimeMillis,
endTimeMillis: endTimeMillis
}
})
这是所有活动类型燃烧的卡路里。如何仅为步骤活动消耗卡路里?