I'm trying to get the data inserted by Google Fit, but only the one that was actually recorded by the sensors and not inserted manually. I thought of checking the data source but it always returns null. Here's the code I used:
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Fitness.HistoryApi.readData(mClient, readRequest)
.setResultCallback(new ResultCallback<DataReadResult>() {
@Override
public void onResult(DataReadResult dataReadResult) {
for (DataSet dataSet : dataReadResult.getDataSets()) {
Log.i(TAG, "Type: " + dataSet.getDataType().getName());
Log.i(TAG, "Source: " + dataSet.getDataSource().getName());
}
for (Bucket bucket : dataReadResult.getBuckets()) {
Log.i(TAG, "Bucket: " + bucket.getActivity());
for (DataSet dataSet : bucket.getDataSets()) {
Log.i(TAG, "Bucket data type: " + dataSet.getDataType().getName());
Log.i(TAG, "Bucket data source: " + dataSet.getDataSource().getName());
}
}
}
});
Is it possible to skip manually inserted data or even get the sensor that was used to get the data?