Result of
HistoryApi.readData(GoogleApiClient,
com.google.android.gms.fitness.request.DataReadRequest)
.
Contains exactly one data set for each detailed data source requested in the
DataReadRequest
.
The methods
getDataSet(DataType)
and
getDataSet(DataSource)
can be used to fetch the resulting detailed data for a
specific data source.
If aggregate data was requested, then the result will return buckets created as per the bucketing strategy specified in the request. Each bucket will have one data set per aggregate data requested.
The method getBuckets()
can be used to retrieve the buckets.
The method getStatus()
can be be used to confirm if the request was successful.
In case the calling app is missing the required permissions, the returned status has
status code set to
FitnessStatusCodes.NEEDS_OAUTH_PERMISSIONS
. In this case the caller should use
Status.startResolutionForResult(Activity, int)
to start an intent to get the
necessary consent from the user before retrying the request.
In case the app attempts to read custom data created by another app, the returned status
has status code set to
FitnessStatusCodes.INCONSISTENT_DATA_TYPE
.
Inherited Constant Summary
Field Summary
public static final Creator<DataReadResult> | CREATOR |
Public Method Summary
boolean | |
List<Bucket> |
getBuckets()
Returns all of the
Buckets
with aggregated data.
|
DataSet | |
DataSet | |
List<DataSet> |
getDataSets()
Returns all of the data sets in the result.
|
Status | |
int |
hashCode()
|
String |
toString()
|
void |
writeToParcel(Parcel dest, int
flags)
|
Inherited Method Summary
Fields
public static final Creator<DataReadResult> CREATOR
Public Methods
public boolean equals (Object o)
public List<Bucket> getBuckets ()
Returns all of the Buckets
with aggregated data. In each bucket, there will be exactly one data set for each
aggregated data source requested in the DataReadRequest
.
Buckets only contain aggregated data requested via
DataReadRequest.Builder.aggregate(DataType)
. Non-aggregated data can be
accessed via
getDataSet(DataType)
.
Returns
- An empty list if the read request failed.
public DataSet getDataSet (DataType dataType)
Returns the resulting data set for the given dataType
. If more than one
data source for the given data type was requested, this method will return the data for
an arbitrary one. Use
getDataSet(DataSource)
to read each specific data source.
This method returns only non-aggregated data sets that were queried via
DataReadRequest.Builder.read(DataType)
or
DataReadRequest.Builder.read(DataSource)
. Aggregated data can be queried via
getBuckets()
.
Returns
- A data set for the given data type, empty if no data was found.
public DataSet getDataSet (DataSource dataSource)
Returns the resulting data set for the given dataSource
.
This method returns only non-aggregated data sets that were queried via
DataReadRequest.Builder.read(DataSource)
. Aggregated data can be queried via
getBuckets()
.
Returns
- A data set for the given data source, empty if no data was found.
public List<DataSet> getDataSets ()
Returns all of the data sets in the result. There will be exactly one data set for
each data source requested in the DataReadRequest
.
This method returns only non-aggregated data sets that were queried via
DataReadRequest.Builder.read(DataType)
or
DataReadRequest.Builder.read(DataSource)
. Aggregated data can be queried via
getBuckets()
.