获取有关健身活动的步骤详情?

Sha*_*n91 5 android google-health google-fit

我正在使用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();
Run Code Online (Sandbox Code Playgroud)

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

我想要这样的东西

crc*_*442 0

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

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