DataReadResult | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public class

# DataReadResult

extends Object
implements Result Parcelable

java.lang.Object
↳ | com.google.android.gms.fitness.result.DataReadResult

## Class Overview

Result of `readData(GoogleApiClient, 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 `NEEDS_OAUTH_PERMISSIONS`. In this case the caller should use `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 `INCONSISTENT_DATA_TYPE`.

## Summary

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Creator<DataReadResult> | CREATOR |

Public Methods
int | describeContents()
boolean | equals(Object that)
List<Bucket> | getBuckets() Returns all of the `Buckets` with aggregated data.
DataSet | getDataSet(DataSource dataSource) Returns the resulting data set for the given `dataSource`.
DataSet | getDataSet(DataType dataType) Returns the resulting data set for the given `dataType`.
List<DataSet> | getDataSets() Returns all of the data sets in the result.
Status | getStatus()
int | hashCode()
String | toString()
void | writeToParcel(Parcel dest, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface com.google.android.gms.common.api.Result
abstract Status | getStatus()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Fields

#### public static final Creator<DataReadResult> CREATOR

## Public Methods

#### public int describeContents ()

#### public boolean equals (Object that)

#### public List<Bucket> getBuckets ()

Returns all of the `Buckets` with aggregated data. There will be exactly one data set for each aggregated data source requested in the `DataReadRequest` per bucket. Returns an empty list if the read request failed.

#### public DataSet getDataSet (DataSource dataSource)

Returns the resulting data set for the given `dataSource`.

##### Returns

- a data set for the given data source, empty if no data was found.

##### Throws

IllegalArgumentException | if the given data source was not part of the read request

#### 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.

##### Returns

- a data set for the given data type, empty if no data was found.

##### Throws

IllegalArgumentException | if the given data type was not part of the read request

#### 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`.

#### public Status getStatus ()

#### public int hashCode ()

#### public String toString ()

#### public void writeToParcel (Parcel dest, int flags)