dataSet.createDataPoint().setTimeInterval() 已弃用健身历史记录 API

dataSet.createDataPoint().setTimeInterval() has been deprecated Fitness History API

我正在编写代码以允许用户在定义的时间段内将步数添加到健身历史记录 API。我正在使用 Fitness History API for Android 参考他们的文档。我找不到 setTimeInterval() 的新方法,是否有任何新方法或解决方法?

int stepCountDelta = 950;
        DataSet dataSet = DataSet.create(dataSource);
        DataPoint dataPoint =
                dataSet.createDataPoint().setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS);

甚至 getValue(Field.FIELD_STEPS).setInt(stepCountDelta); setInt() 已被弃用。

如其所说in the documentation:

public DataPoint setTimestamp (long timestamp, TimeUnit timeUnit)

This method is deprecated. use DataPoint.Builder to create DataPoint instances.

所以,做类似的事情:

DataPoint dataPoint =
    DataPoint.builder(dataSource)
        .setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
        .build();

DataSet.Builder dataSet = DataSet.builder(dataSource);    
dataSet.addDataPoint(dataPoint);