我有凭据,并且已被授权。然后我想获取数据(例如重量或步长)。 https://keestalkstech.com/2016/07/getting-your-weight-from-google-fit-with-c/ 我尝试了这段代码,但最初在时间上遇到了问题,然后有了一个可为空的数组,但是在我的帐户中,我拥有了特定日期的所有信息(步骤,更新的权重)。因此,然后我尝试在developers.google.com上构建请求,但出现错误400(错误请求):
#1
{
"application": {
"name": "MyCare"
},
"dataType": {
"field": [
{
"format": "integerList",
"name": "steps"
}
],
"name": "com.google.step_count.delta"
},
"device": {
"manufacturer": "MyCare",
"model": "xiaomi",
"type": "phone",
"uid": "",
"version": "1.0"
},
"type": "derived"
}
#2
{
"application": {
"name": "MyCare"
},
"dataType": {
"field": [
{
"format": "integerList",
"name": "weight"
}
],
"name": "com.google.weight"
},
"device": {
"manufacturer": "",
"model": "",
"type": "phone",
"uid": "",
"version": "1.0"
},
"type": "derived"
}
我使用了userId“ me”。但是,当我尝试使用经我授权的clientId时,出现错误403“未授权”。...
我应该如何执行此查询,或者可能还有其他一些变体来获取c#中的数据。我使用Google.Apis.Fitness.v1并创建了健身服务:
var service = new FitnessService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName});
..}
我也找到了这种方法,但是我有可为空的数组。我认为这种方式是不正确的,请帮助我重做:
var service = new FitnessService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName});
var dataSets = service.Users.Dataset.Aggregate(
new AggregateRequest
{
AggregateBy = new[] {
new AggregateBy {DataTypeName = "com.google.location.sample"}}
}, "me")
.ExecuteAsync();
var result = dataSets.Result;
}
请帮助!我需要在3个小时内完成:((( 但是对于2个mounth就有这个问题。