【问题标题】:Getting Steps details with respect to fitness activities?获取有关健身活动的 Steps 详细信息?
【发布时间】:2015-06-22 05:44:20
【问题描述】:

我正在使用 Google Fit SDK,我可以轻松获取步骤详细信息,但我真的很难在执行这些步骤时获取正在完成的活动。

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.HOURS)
            .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
            .build();

作为回应,如果我检查 DataSet 源,它总是 com.google.step_count.delta

【问题讨论】:

    标签: android google-fit google-health


    【解决方案1】:

    我认为你应该使用 bucketByActivityType 而不是 bucketByTime。

    然后,在生成的 Bucket 的数据集上,使用getActivity() 获取活动类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-23
      • 2020-07-12
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      • 2014-07-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多