java.lang.Object | |
↳ | com.google.android.gms.fitness.request.DataReadRequest.Builder |
Builder used to create new DataReadRequests.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds the default data source for the given aggregate
dataType to this request
and sets the output aggregate data type to be returned.
| |||||||||||
Adds a specific data source we want aggregate data from for this request and also sets
the output aggregate data type that will be returned.
| |||||||||||
Specifies bucket type as
TYPE_ACTIVITY_SEGMENT , sets the minimum duration
of each TYPE_ACTIVITY_SEGMENT for the bucket.
| |||||||||||
Specifies bucket type as
TYPE_ACTIVITY_SEGMENT , sets the minimum duration
of each TYPE_ACTIVITY_SEGMENT for the bucket.
| |||||||||||
Specifies bucket type as
TYPE_ACTIVITY_TYPE , sets the minimum duration of
each TYPE_ACTIVITY_SEGMENT for computing the buckets.
| |||||||||||
Specifies bucket type as
TYPE_ACTIVITY_TYPE , sets the minimum duration of
each TYPE_ACTIVITY_SEGMENT for computing the buckets and sets the
activity data source to be used to read activity segments from.
| |||||||||||
Specifies bucket type as
TYPE_SESSION and sets the minimum duration of
each Session for the bucket.
| |||||||||||
Specifies bucket type as
TYPE_TIME and sets the duration of each bucket.
| |||||||||||
Finishes building and returns the request.
| |||||||||||
Enable querying the Google Fit server to fetch query results,
in case the local store doesn't have data for the full requested time range.
| |||||||||||
Adds the default data source to read for the given
dataType to this request.
| |||||||||||
Adds a specific data source we want to read data from to this request.
| |||||||||||
Limits results to the latest
limit data points.
| |||||||||||
Sets the time range for our query.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Adds the default data source for the given aggregate dataType
to this request
and sets the output aggregate data type to be returned. For a list of valid output
aggregate data types for a given input data type
see getAggregatesForInput(DataType)
.
The default data source is selected based on all available sources for the given data type, and may be averaged or filtered. Aggregation should be requested in conjunction with one of the bucketing strategy: by time, session or activity. At least one valid detailed data source or aggregate data source should be specified in the request
This method can be used instead of aggregate(DataSource, DataType)
when the application is not interested in a specific data source.
inputDataType | the input data type we're aggregating |
---|---|
outputDataType | the output data type that will be returned |
IllegalStateException | if the data type is already requested as detailed |
---|---|
IllegalArgumentException | if the input data type is not supported for aggregation or if the output data type is invalid |
NullPointerException | if the data type is null |
Adds a specific data source we want aggregate data from for this request and also sets
the output aggregate data type that will be returned. For a list of valid output
aggregate data types for a given input data type
see getAggregatesForInput(DataType)
.
Aggregation should be requested in conjunction with one of the bucketing strategy: by time, session or activity. At least one valid detailed data source or aggregate data source should be specified in the request.
dataSource | the data source we're reading for aggregate data |
---|---|
outputDataType | the output data type that will be returned in the result |
IllegalStateException | if the data source is already requested as detailed |
---|---|
IllegalArgumentException | if the input data type is not supported for aggregation or if the output aggregate data type is invalid |
NullPointerException | if the data source is null |
Specifies bucket type as TYPE_ACTIVITY_SEGMENT
, sets the minimum duration
of each TYPE_ACTIVITY_SEGMENT
for the bucket.
An TYPE_ACTIVITY_SEGMENT
represents a continuous time interval with a
single activity value. In this case, each Bucket
will represent an individual
activity segment which lies inside the time interval of the request. For instance,
if the user had two separate activity segments for walking, one for 1km and another for
2km, the result will be two buckets one with distance value of 1km and another with
distance value of 2km.
If no activity segments exist recorded for specific time intervals of the read query,
a Bucket corresponding to activity type
UNKNOWN
will be used instead.
For instance, if there is an activity segment for biking from time [20, 30] seconds
and for running from time [40, 50] seconds, the result for a read query over [0, 60]
will have the following buckets:
Only activity segments of duration longer than minDuration
are chosen for
bucketing.
By default, activity segments are chosen from the default data source. To use a
specific data source, use bucketByActivitySegment(int, TimeUnit, DataSource)
.
Detailed data of the aggregate type(s) specified in the request over time interval of
each bucket will be aggregated and returned. Each bucket will have one DataSet
of aggregated data for each requested aggregate DataType
.
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid minDuration is specified |
---|
Specifies bucket type as TYPE_ACTIVITY_SEGMENT
, sets the minimum duration
of each TYPE_ACTIVITY_SEGMENT
for the bucket.
An TYPE_ACTIVITY_SEGMENT
represents a continuous time interval with a
single activity value. In this case, each Bucket
will represent an individual
activity segment which lies inside the time interval of the request. For instance,
if the user had two separate activity segments for walking, one for 1km and another for
2km, the result will be two buckets one with distance value of 1km and another with
distance value of 2km.
If no activity segments exist recorded for specific time intervals of the read query,
a Bucket corresponding to activity type
UNKNOWN
will be
added for each missing interval. For instance, if there is an activity segment
for biking from time [20, 30] seconds and for running from time [40, 50] seconds,
the result for a read query over [0, 60] will have the following buckets:
Only activity segments of duration longer than minDuration
are chosen for
bucketing.
The activity segments are chosen from the specified activityDataSource
. To use
the default activity data source, use bucketByActivitySegment(int, TimeUnit)
.
Detailed data of the aggregate type(s) specified in the request over time interval of
each bucket will be aggregated and returned. Each bucket will have one DataSet
of aggregated data for each requested aggregate DataType
.
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid minDuration is specified |
---|
Specifies bucket type as TYPE_ACTIVITY_TYPE
, sets the minimum duration of
each TYPE_ACTIVITY_SEGMENT
for computing the buckets.
In this case, each Bucket
will represent an activity type,
and be comprised of aggregated data over all individual activity segments of this
activity which lie inside the time interval of the request. For instance,
if the user had two separate activity segments of walking during the time interval,
one for a distance of 1km and another for a distance of 2km,
the result will be one activity bucket with a single aggregate data point for distance
with a value of 3km.
If no activity segments are recorded for specific time intervals of the read query,
segments of type UNKNOWN
will be added for these intervals and used to compute an aggregate bucket of activity
type Unknown.
Only activity segments of duration longer than minDuration
are chosen for
bucketing.
By default, activity segments are chosen from the default data source. To use a
specific data source, use bucketByActivitySegment(int, TimeUnit, DataSource)
.
Detailed data of the aggregate type(s) specified in the request over time interval of
each bucket will be aggregated and returned. Each bucket will have one DataSet
of aggregated data for each requested aggregate DataType
.
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid minDuration is specified. |
---|
Specifies bucket type as TYPE_ACTIVITY_TYPE
, sets the minimum duration of
each TYPE_ACTIVITY_SEGMENT
for computing the buckets and sets the
activity data source to be used to read activity segments from.
In this case, each Bucket
will represent an activity type,
and be comprised of aggregated data over all individual activity segments of this
activity which lie inside the time interval of the request. For instance,
if the user had two separate activity segments of walking during the time interval,
one for a distance of 1km and another for a distance of 2km,
the result will be one activity bucket with a single aggregate data point for distance
with a value of 3km.
If no activity segments are recorded for specific time intervals of the read query,
segments of type UNKNOWN
will be added for these intervals and used to compute an aggregate bucket of activity
type Unknown.
Only activity segments of duration longer than minDuration
are chosen for
bucketing.
The activity segments are chosen from the specified activityDataSource
. To use
the default activity segment data source
use bucketByActivityType(int, TimeUnit)
.
Detailed data of the aggregate type(s) specified in the request over time interval of
each bucket will be aggregated and returned. Each bucket will have one DataSet
of aggregated data for each requested aggregate DataType
.
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid minDuration is specified or if an invalid activity data source is specified. |
---|
Specifies bucket type as TYPE_SESSION
and sets the minimum duration of
each Session
for the bucket.
A Session
represents a time interval with associate meta data to store
user-visible groups of related data. In this case, each bucket will signify a session
which lies inside the time interval of the request.
Detailed data of the aggregate type(s) specified in the request over time interval of
each bucket will be aggregated and returned. Each bucket will have one DataSet
of aggregated data for each requested aggregate DataType
..
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid minDuration is specified |
---|
Specifies bucket type as TYPE_TIME
and sets the duration of each bucket.
The detailed data from the Google Fit store across the time interval of the request is
divided into sub-intervals of length duration
, and aggregation is then performed
over each sub-interval to return one Bucket
of aggregated data per sub-interval.
Aggregation is performed for data type(s) specified in the request. Each bucket
will have one DataSet
of aggregated data per requested aggregate DataType
.
IllegalArgumentException | if another bucket type is already specified in the request or if an invalid duration is specified. |
---|
Finishes building and returns the request.
IllegalStateException | if the builder doesn't have enough state to create a valid request |
---|
Enable querying the Google Fit server to fetch query results, in case the local store doesn't have data for the full requested time range. Server results will be combined with local results into one DataSet.
Note that querying the server adds latency, specially under poor network conditions. Also note that attempting to query the server when there is no network connection may result in atransient error
.
Server queries are off by default.
Adds the default data source to read for the given dataType
to this request. The
default data source is selected based on all available sources for the given data
type, and may be averaged or filtered. At least one valid detailed data source or
aggregate data source should be specified in the request.
This method can be used instead of read(DataSource)
when the
application is not interested in a specific data source.
dataType | the data type we're reading |
---|
IllegalStateException | if the data type is already requested as aggregate |
---|---|
NullPointerException | if the data type is null |
Adds a specific data source we want to read data from to this request. At least one valid detailed data source or aggregate data source should be specified in the request.
dataSource | the data source we're reading |
---|
IllegalArgumentException | if the data source is already requested as aggregate |
---|---|
NullPointerException | if the data source is null |
Limits results to the latest limit
data points. This parameter is ignored for
aggregated queries. By default there is no limit.
This method is useful to reduce the amount of sent data as well as to support scenarios like requesting the current (limit == 1 to get the latest value) weight or height.
Sets the time range for our query. Defined start and end times are required for every read query.
start | a start time, in the given unit since epoch, inclusive |
---|---|
end | an end time, in the given unit since epoch, inclusive |
timeUnit | the unit of the start and end timestamps |