public class

DataReadRequest

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

Class Overview

Request for reading data from Google Fit. Use this request to specify the data types to read, as well as aggregation parameters. Read requests require a time range and allow reading data in detailed or aggregated fashion. A single request can be used to read multiple data types and data sources together.

Detailed Data

For requesting detailed data, the request should specify:
  • the time interval for the data
  • at least one data source or data type
Example usage for reading location samples during an interval:
     new DataReadRequest.Builder()
         .setTimeRange(startTime.getMillis(), endTime.getMillis())
         .read(DataTypes.LOCATION_SAMPLE)
         .build();
 

Aggregated Data

For requesting aggregate data, the request should specify a valid bucketing strategy. Apps can request to bucket by time, activity type, activity segment, or session. Apps should also specify at least one input data source or data type to aggregate. See INPUT_TYPES for a list of valid input data types supported for aggregation.

The aggregation request should specify:

  • time interval for the data
  • at least one input data source or data type to aggregate and its corresponding output aggregate data types
  • bucketing strategy for aggregation

Example usage for selecting location bounding boxes for each hour:

     new DataReadRequest.Builder()
          .setTimeRange(startTime.getMillis(), endTime.getMillis())
          .bucketByTime(1, TimeUnit.HOURS)
          .aggregate(DataTypes.LOCATION_SAMPLE, AggregateDataTypes.LOCATION_BOUNDING_BOX)
          .build();
 

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)