Google FIT API 和 Goole FIT App 的分钟级数据不匹配

问题描述

我正在尝试从 Google FIT API 查询步数数据,但在将步数值与 Google FIT 应用 进行比较时遇到了差异。

奇怪的是,当我尝试将 bucketByTime(1,TimeUnit.MINUTES) 更改为 bucketByTime(1,TimeUnit.DAYS)bucketByTime(1,TimeUnit.HOURS) 时,返回的步数与 Google FIT 应用程序中的步数相匹配。当我使用 TimeUnit.MINUTES 时,差异开始出现。

请注意,根据分钟参数的值,差异不一致。如果设置了 bucketByTime(1,TimeUnit.MINUTES),总步数将为 2479。但是,当我将参数更改为此 bucketByTime(2,TimeUnit.MINUTES) 时,返回的总步数将为 2477。但 Google FIT App 总步数为 2476。

以下是我的代码

DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
                .setDataType(DataType.TYPE_STEP_COUNT_DELTA)
                .setType(DataSource.TYPE_DERIVED)
                .setStreamName("estimated_steps")
                .setAppPackageName("com.google.android.gms")
                .build();
        DataReadRequest readRequest = new DataReadRequest.Builder()
                .aggregate(ESTIMATED_STEP_DELTAS,DataType.AGGREGATE_STEP_COUNT_DELTA)
                .bucketByTime(1,TimeUnit.MINUTES)
                .setTimeRange(start,end,TimeUnit.MILLISECONDS)
                .build();

        Task<DataReadResponse> response = fitness.getHistoryClient(context,GoogleSignIn.getLastSignedInAccount(context)).readData(readRequest);

所以我想要的是 Google FIT API 返回的总步数值与使用 bucketByTime(1,TimeUnit.MINUTES)Google FIT App 保持一致。

希望这里有人可以帮助我,因为我在发帖之前确实尝试在互联网上寻找答案或类似的帖子,但我找不到。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)