API文档指出,要获得类似Google Fit App的结果,应请求derived:com.google.step_count.delta:com.google.android.gms:estimated_steps
数据源的步骤
https://developers.google.com/fit/scenarios/read-daily-step-total
https://developers.google.com/fit/faq#get-step-count
实际上,这似乎是正确的,但有时结果并不理想。
进行一些测试后,我发现有时使用derived:com.google.step_count.delta:com.google.android.gms:merge_step_deltas
数据源可以获得更好的结果,或者至少与Google Fit应用中显示的值更相似。
尽管如此,我认为,如果用户使用更多设备来计算步骤,则此数据源将使我将所有步骤组合在一起,这是错误的。
使用estimated_steps
数据源是否正确,还是应该切换到merge_step_deltas
?
还是我可以采取其他措施来获得正确的步骤数?
客户的步骤与Google Fit应用显示的步骤不匹配。
这是他的数据源列表
{
"dataSource": [
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "duration",
"format": "integer"
}
],
"name": "com.google.active_minutes"
},
"dataStreamName": "from_activity<-merge_activity_segments",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.active_minutes:com.google.android.gms:from_activity<-merge_activity_segments",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "duration",
"format": "integer"
}
],
"name": "com.google.active_minutes"
},
"dataStreamName": "from_steps<-estimated_steps",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.active_minutes:com.google.android.gms:from_steps<-estimated_steps",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "duration",
"format": "integer"
}
],
"name": "com.google.active_minutes"
},
"dataStreamName": "merge_active_minutes",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.active_minutes:com.google.android.gms:merge_active_minutes",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "activity",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"dataStreamName": "merge_activity_segments",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.activity.segment:com.google.android.gms:merge_activity_segments",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "activity",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"dataStreamName": "platform_activity_segments",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.activity.segment:com.google.android.gms:platform_activity_segments",
"type": "derived"
},
{
"dataStreamName": "activity_from_steps",
"dataType": {
"field": [
{
"name": "activity",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"dataQualityStandard": [],
"application": {
"packageName": "com.google.android.gms"
},
"device": {
"model": "SM-A600FN",
"version": "",
"type": "phone",
"uid": "324bd687",
"manufacturer": "samsung"
},
"dataStreamId": "derived:com.google.activity.segment:com.google.android.gms:samsung:SM-A600FN:324bd687:activity_from_steps",
"type": "derived"
},
{
"dataStreamName": "from_activity_samples<-derived:com.google.activity.samples:com.google.android.gms:samsung:SM-A600FN:324bd687:detailed",
"dataType": {
"field": [
{
"name": "activity",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"dataQualityStandard": [],
"application": {
"packageName": "com.google.android.gms"
},
"device": {
"model": "SM-A600FN",
"version": "",
"type": "phone",
"uid": "324bd687",
"manufacturer": "samsung"
},
"dataStreamId": "derived:com.google.activity.segment:com.google.android.gms:samsung:SM-A600FN:324bd687:from_activity_samples<-derived:com.google.activity.samples:com.google.android.gms:samsung:SM-A600FN:324bd687:detailed",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "calories",
"format": "floatPoint"
}
],
"name": "com.google.calories.expended"
},
"dataStreamName": "from_activities",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.calories.expended:com.google.android.gms:from_activities",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "calories",
"format": "floatPoint"
}
],
"name": "com.google.calories.expended"
},
"dataStreamName": "merge_calories_expended",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.calories.expended:com.google.android.gms:merge_calories_expended",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "calories",
"format": "floatPoint"
}
],
"name": "com.google.calories.expended"
},
"dataStreamName": "platform_calories_expended",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "intensity",
"format": "floatPoint"
}
],
"name": "com.google.heart_minutes"
},
"dataStreamName": "from_activity<-merge_activity_segments",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.heart_minutes:com.google.android.gms:from_activity<-merge_activity_segments",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "intensity",
"format": "floatPoint"
}
],
"name": "com.google.heart_minutes"
},
"dataStreamName": "from_heart_rate<-merge_heart_rate_bpm",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.heart_minutes:com.google.android.gms:from_heart_rate<-merge_heart_rate_bpm",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "intensity",
"format": "floatPoint"
}
],
"name": "com.google.heart_minutes"
},
"dataStreamName": "from_steps<-estimated_steps",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.heart_minutes:com.google.android.gms:from_steps<-estimated_steps",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "intensity",
"format": "floatPoint"
}
],
"name": "com.google.heart_minutes"
},
"dataStreamName": "merge_heart_minutes",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.heart_minutes:com.google.android.gms:merge_heart_minutes",
"type": "derived"
},
{
"dataStreamName": "soft_step_counter",
"dataType": {
"field": [
{
"name": "steps",
"format": "integer"
}
],
"name": "com.google.step_count.cumulative"
},
"dataQualityStandard": [],
"application": {
"packageName": "com.google.android.gms"
},
"device": {
"model": "SM-A600FN",
"version": "",
"type": "phone",
"uid": "324bd687",
"manufacturer": "samsung"
},
"dataStreamId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SM-A600FN:324bd687:soft_step_counter",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "steps",
"format": "integer"
}
],
"name": "com.google.step_count.delta"
},
"dataStreamName": "estimated_steps",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps",
"type": "derived"
},
{
"dataQualityStandard": [],
"dataType": {
"field": [
{
"name": "steps",
"format": "integer"
}
],
"name": "com.google.step_count.delta"
},
"dataStreamName": "merge_step_deltas",
"application": {
"packageName": "com.google.android.gms"
},
"dataStreamId": "derived:com.google.step_count.delta:com.google.android.gms:merge_step_deltas",
"type": "derived"
},
{
"dataStreamName": "derive_step_deltas<-derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SM-A600FN:324bd687:soft_step_counter",
"dataType": {
"field": [
{
"name": "steps",
"format": "integer"
}
],
"name": "com.google.step_count.delta"
},
"dataQualityStandard": [],
"application": {
"packageName": "com.google.android.gms"
},
"device": {
"model": "SM-A600FN",
"version": "",
"type": "phone",
"uid": "324bd687",
"manufacturer": "samsung"
},
"dataStreamId": "derived:com.google.step_count.delta:com.google.android.gms:samsung:SM-A600FN:324bd687:derive_step_deltas<-derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SM-A600FN:324bd687:soft_step_counter",
"type": "derived"
},
{
"name": "Generic ANT+ Sensor",
"dataStreamName": "AntPlus.0.124",
"dataType": {
"field": [
{
"name": "steps",
"format": "integer"
}
],
"name": "com.google.step_count.delta"
},
"dataQualityStandard": [],
"application": {
"packageName": "com.dsi.ant.plugins.antplus"
},
"dataStreamId": "raw:com.google.step_count.delta:com.dsi.ant.plugins.antplus:AntPlus.0.124",
"type": "raw"
}
]
}
5月2日,该应用程序显示了15000个步骤(与merge_step_deltas
数据源匹配),而从estimated_steps
数据源请求的步骤使我获得了大约7000个步骤。
derived:com.google.step_count.delta:com.google.android.gms:estimated_steps
{
"bucket": [
{
"startTimeMillis": "1556748000000",
"endTimeMillis": "1556834400000",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1556748469517481594",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SM-A600FN:4dc460aaeb28b288:soft_step_counter",
"endTimeNanos": "1556831065968126307",
"value": [
{
"mapVal": [],
"intVal": 7601
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
}
]
}
derived:com.google.step_count.delta:com.google.android.gms:merge_step_deltas
{
"bucket": [
{
"startTimeMillis": "1556748000000",
"endTimeMillis": "1556834400000",
"dataset": [
{
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1556748469517481594",
"originDataSourceId": "derived:com.google.step_count.cumulative:com.google.android.gms:samsung:SM-A600FN:4dc460aaeb28b288:soft_step_counter",
"endTimeNanos": "1556831065968126307",
"value": [
{
"mapVal": [],
"intVal": 15368
}
],
"dataTypeName": "com.google.step_count.delta"
}
]
}
]
}
]
}