【问题标题】:React Native - Mismatch in steps between getDailyStepCountSamples and Google Fit AppReact Native - getDailyStepCountSamples 和 Google Fit App 之间的步骤不匹配
【发布时间】:2021-09-15 13:18:16
【问题描述】:

问题

当我致电 GoogleFit.getDailyStepCountSamples() 检索步数时,我收到的步数远低于 Google Fit 应用中显示的步数。

开发环境

MacOS 大苏尔 反应原生 0.63.3 Android 模拟器 - Nexus 5 API 19

复制步骤

设置您的步骤选项并调用该函数。代码如下所示

const stepsOpt = {
    startDate: '2021-09-15T00:00:00.000Z', // the start of the day in question
    endDate: new Date().toISOString(), // you could also set this to the end of the day
    bucketUnit: 'MINUTE',
    bucketInterval: 1
}
  
const res = await GoogleFit.getDailyStepCountSamples(stepsOpt)
console.log(`\n\nMy step data is\n${JSON.stringify(res, null, 2)}\n\n`)

在生成的日志中,观察来自任何com.google.android.gms 源的数据。查看总步数和 rawSteps。 将此与 Google Fit 应用程序中显示的当天总步数进行比较(可以通过打开 Google Fit 应用程序 -> 首页 -> 找到趋势/步骤 -> -> 查看源数据

我观察到的

总步数和 rawSteps 不匹配

我的预期

  • 查看总步数之间的匹配项
  • 查看 rawStep 数据中的一些匹配项

截图

左边是运行我的代码后的日志截图。右图是根据 Google Fit 应用的原始数据截图。

【问题讨论】:

    标签: android react-native google-fit


    【解决方案1】:

    简而言之,如果是同步问题,您无能为力,只能等待。

    如果它是由数据仅从本地设备存储中获取的。 或者Google Fit app中的部分数据来自其他应用,这两个需要调查和复制。

    https://developers.google.com/fit/faq#how_do_i_get_the_same_values_step_count_calories_distance_etc_as_the_google_fit_app

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      相关资源
      最近更新 更多