现在我正在我的android应用程序中实现googlefit。我找不到任何合适的文件来获取心率。请帮我从googlefit sdk/api获取心率数据。
如果您主要依赖Fit的聚合类型";Heart Points";,然后你可以在你的聚合请求体中有这个:
{
"aggregateBy": [
{
"dataTypeName": "com.google.heart_minutes",
"dataSourceId": "derived:com.google.heart_minutes:com.google.android.gms:merge_heart_minutes"
}
],
"bucketByTime": {
"durationMillis": 86400000 //bucketed in a day
},
"startTimeMillis": //insert your start time in millis,
"endTimeMillis": //insert your end time in millis
}
但如果你真的想提取原始心率数据点,你可以用这个身体来执行:
{
"aggregateBy": [
{
"dataTypeName": "com.google.heart_rate.bpm",
"dataSourceId": "derived:com.google.heart_rate.bpm:com.google.android.gms:merge_heart_rate_bpm"
}
],
"bucketByTime": {
"durationMillis": 8640000 //bucketed in a day
},
"startTimeMillis": //insert your start time in millis,
"endTimeMillis": //insert your end time in millis
}
我建议您熟悉Fit系统架构,尤其是查询要查询的类型的可用数据源。