0

I'm trying to query, with the Fit rest API, segmented data from an iphone that have installed GoogleFit and configured the sync between apple health and googelfit.

To my android phone, I get the data as expected with this POST:

(*)

  "aggregateBy": [
    {
      "dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps",
      "dataTypeName": "com.google.step_count.delta"
    },
    {
      "dataSourceId": "derived:com.google.distance.delta:com.google.android.gms:merge_distance_delta",
      "dataTypeName": "com.google.distance.delta"
    }
    {
      "dataSourceId": "derived:com.google.active_minutes:com.google.android.gms:merge_active_minutes",
      "dataTypeName": "com.google.active_minutes"
    }
  ],
  "endTimeMillis": 1643325227000,
  "startTimeMillis": 1640991600000,
  "bucketByActivitySegment": {
    "minDurationMillis": 600000
  }

}

But from the iphone user, this returns an empty bucket.

I checked the available data dataSources for the apple user. I did some "trial and error" on the dataSourceIds connected to "active_minutes". In particular

  1. derived:com.google.active_minutes:com.google.ios.fit:appleinc.:iphone:1148c16f:top_level
  2. derived:com.google.active_minutes:com.google.ios.fit:appleinc.:watch:f40f5c4a:top_level

The trial and error werer conducted with aggregateBy post with one of the above sources, so no distance and step_count involved. The two above dataSourceIds were obtained from a "list post query" for available dataSources, done by the iphone user, with the following scopes:

fitness.activity.read
fitness.location.read

No segmented data is returned from either dataSourceIds (an empty bucket as well). Contents within the apple user's app indicates that there should be segmented data somewhere, see screenshot link.

(Edit: also tried setting "minDurationMillis: 0")

Meanwhile, queries such as:

(**)

{
  "aggregateBy": [
    {
      "dataSourceId": "derived:com.google.distance.delta:com.google.android.gms:merge_distance_delta",
      "dataTypeName": "com.google.distance.delta"
    }
  ],
  "endTimeMillis": 1643325227000,
  "startTimeMillis": 1640991600000,
  "bucketByTime": {
    "durationMillis": 2333627000
  }
}

does return data from the apple user. But I'm really interested in segments (minimum 10 minutes long)

So, question: Anyone with experience getting segmented data from apple-googlefit users?

Figure: iphone screenshot

4

1 回答 1

0

更新。

由于 (**)(见第一篇文章)确实从 iphone 返回了数据,我为 android 和 iphone 使用了 1 小时的“bucketByTime”解决方案。

如果段很重要,则可以将“bucketByTime”数据解析/过滤成段。但是,此 POST 无法获取活动类型。

出现了新问题:

如前所述,(**) POST 返回数据。特别是在:

"startTimeMillis" = [2022 年初]

"endTimeMillis" = [现在]。

一个 cron 执行器被配置为使得 (**) 每天重复一次,其中:

"startTimeMillis" = ["以前的现在"]

"endTimeMillis" = [现在]。

但是,这不会从 iphone 用户返回任何数据。澄清一下,没有从 iphone 收到每日数据。

一些预先进行的检查:

  1. iPhone 用户在 GoogleFit 应用程序的前端视图中可以正常查看数据(请参阅第一篇文章中的屏幕截图链接)。
  2. 尝试 (**) 每个可用的“dataStreamId”和“名称”(从可用数据源的“列表发布查询”返回) - 不返回任何内容。
  3. 根据此支持页面,要求 iphone 用户检查 GoogleFit 的权限。(我必须相信他们的配置正确)

重要发现:

对于一位 iphone 用户,有时会返回“不完整”[2] 数据。我在想象这个数据是他的苹果手表记录的数据。我让他今天戴手表。

你会想,当要求例如。merge _distance_delta应用程序将可用资源合并到一个整洁的时间线中。此级别的问题不公开(据我所知)。

[2] 总和不(接近)匹配 GoogleFiT 前端结果(就像它为 android 用户所做的那样)。

于 2022-02-05T09:01:15.797 回答