Class Overview
Request for reading data, aggregated or detailed, from the Google Fit store. Use this
request to specify the data sources and the time range for the query. This request does not
allow adding the same data type or data source for both aggregated and detailed data.
Detailed Data: For requesting detailed data, the request should specify:
- time interval for the data
- at least one data source
Example usage for requesting detailed data:
new DataReadRequest.Builder()
.addDefaultDataSource(DataTypes.LOCATION)
.setTimeRange(startTime.getMillis(), endTime.getMillis())
.build();
Aggregated Data: For requesting aggregated data, the request should specify:
Example usage for requesting aggregated data:
new DataReadRequest.Builder()
.setTimeRange(startTime.getMillis(), endTime.getMillis())
.addAggregatedDefaultDataSource(DataTypes.STEP_COUNT_DELTA)
.bucketByTime(duration, TimeUnit.MILLISECONDS)
.build();
Aggregated and Detailed Data It is permitted to request both aggregated and
detailed data in the same request, as long as the data types are different. Example usage for
requesting detailed and aggregated data in one request:
new DataReadRequest.Builder()
.setTimeRange(startTime.getMillis(), endTime.getMillis())
.addDefaultDataSource(DataTypes.LOCATION)
.addAggregatedDefaultDataSource(DataTypes.STEP_COUNT_DELTA)
.bucketByTime(duration, TimeUnit.MILLISECONDS)
.build();
App can only read data of a public data type or a custom data type created by the app itself.
Custom data type created by another app cannot be read.