从Google Fit Api获取位置数据 [英] Getting location data from Google Fit Api
问题描述
我正在尝试从我通过移动设备添加的Google Fit活动中获取位置数据.我目前正在使用OAuth2 Playground来测试请求.
I am trying to fetch location data from Google fit activity which I have added through mobile. I am currently using OAuth2 Playground to test the request.
我正在使用的请求URI是:https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate
The request URI i am using is : https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate
请求正文
{
"aggregateBy": [{
"dataTypeName": "com.google.location.sample"
}, {
"dataTypeName": "com.google.distance.delta"
}],
bucketBySession:{
minDurationMillis: 1
},
"startTimeMillis": 1522281600000,
"endTimeMillis": 1522368000000
}
回复
{
"bucket": [
{
"session": {
"modifiedTimeMillis": "1522382434459",
"endTimeMillis": "1522316136834",
"description": "",
"activityType": 7,
"application": {
"packageName": "com.google.android.apps.fitness"
},
"startTimeMillis": "1522316098654",
"id": "cfd891371580xxxx:activemode:walking:152231609xxxx",
"name": "Afternoon walking"
},
"startTimeMillis": "1522316098654",
"endTimeMillis": "1522316136834",
"dataset": [
{
"dataSourceId": "derived:com.google.location.bounding_box:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1522316101582000000",
"originDataSourceId": "raw:com.google.location.sample:com.google.android.gms:motorola:Moto G (4):cfd891371580xxxx:live_location",
"endTimeNanos": "1522316134619000000",
"value": [
{
"mapVal": [],
"fpVal": 9.7610998153686523
},
{
"mapVal": [],
"fpVal": 76.626411437988281
},
{
"mapVal": [],
"fpVal": 9.7616653442382812
},
{
"mapVal": [],
"fpVal": 76.626708984375
}
],
"dataTypeName": "com.google.location.bounding_box"
}
]
},
{
"dataSourceId": "derived:com.google.distance.delta:com.google.android.gms:aggregated",
"point": [
{
"startTimeNanos": "1522316098654000000",
"originDataSourceId": "raw:com.google.location.sample:com.google.android.gms:motorola:Moto G (4):cfd891371580xxxx:live_location",
"endTimeNanos": "1522316136834000000",
"value": [
{
"mapVal": [],
"fpVal": 83.398760318756104
}
],
"dataTypeName": "com.google.distance.delta"
}
]
}
]
}
]
}
但是这些回复并未提供我可以在我的网站上显示的往返地点信息.
But these response does not provide a from and to location information which I can show in my website.
-
还有其他我可以用来获取位置信息的
dataTypeName
吗?
显示的边界框数据是什么?可以通过任何方式显示位置吗?
What is the bounding box data shown? Is it useful in any way to show location?
"dataTypeName": "com.google.distance.delta"
提供的数据是什么意思?是起点和终点之间的距离吗?
What is the data provided by "dataTypeName": "com.google.distance.delta"
mean? Is it the distance between start and end location?
推荐答案
位置数据只能由写入该数据的应用读取.您的应用只能读取其写入的数据.它无法读取由其写入的位置示例数据其他应用." 来自developers.google.com
"Location data can only be read by the app that wrote the data. Your app can only read back data it wrote. It cannot read location sample data written by other apps." from developers.google.com
这篇关于从Google Fit Api获取位置数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!