Android APIs
public class

DataReadRequest

extends Object
implements SafeParcelable
java.lang.Object
   ↳ com.google.android.gms.fitness.DataReadRequest

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.

Summary

Nested Classes
class DataReadRequest.Builder Builder used to create new DataReadRequests. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
Fields
public static final Creator<DataReadRequest> CREATOR
Public Methods
int describeContents()
boolean equals(Object that)
int hashCode()
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<DataReadRequest> CREATOR

Public Methods

public int describeContents ()

public boolean equals (Object that)

public int hashCode ()

public String toString ()

public void writeToParcel (Parcel dest, int flags)