public class

Bucket

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

Class Overview

A bucket represents a time interval over which aggregated data is computed. For example, a bucket can represent user's average speed and average heart rate over a 1 hour interval. Currently we allow buckets to be computed by only one of the following strategies:

  1. time: a time bucket can represent a full day, hour, or any other desired interval
  2. activity type: an activity type represents a DetectedActivity
  3. activity segments: an activity segment represents data for one activity segment
  4. sessions: a session bucket represents data for one session

A Bucket consists of the following fields:

  • startTimeMillis denotes the start time of the bucket, in milliseconds since epoch. This field is always present.
  • endTimeMillis denotes the end time of the bucket, in milliseconds since epoch. This field is always present.
  • session denotes the associated session with the bucket. This is an optional field that is set only if the read query had requested bucketing by sessions.
  • activity denotes the associated activity with the bucket as defined in DetectedActivity. This is an optional field and is set only if the read query had requested bucketing of data by activity segments.
  • dataSets DataSets for the aggregated DataTypes requested in the read query over the time interval of this bucket.
  • bucketType denotes if the bucketing is by time, session or activity. This field is always present and set to one of TYPE_TIME, TYPE_SESSION, TYPE_ACTIVITY_SEGMENT or {link Type#ACTIVITY_TYPE}.

Summary

Constants
int TYPE_ACTIVITY_SEGMENT Type constant denoting that bucketing by individual activity segment is requested.
int TYPE_ACTIVITY_TYPE Type constant denoting that bucketing by activity type is requested.
int TYPE_SESSION Type constant denoting that bucketing by session is requested.
int TYPE_TIME Type constant denoting that bucketing by time is requested.
[Expand]
Inherited Constants
From interface android.os.Parcelable
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
Fields
public static final Creator<Bucket> CREATOR
Public Methods
int describeContents()
boolean equals(Object o)
int getActivity()
Returns the activity of the bucket if bucketing by activity was requested, UNKNOWN otherwise.
int getBucketType()
Returns the type of the bucket.
DataSet getDataSet(DataType dataType)
Returns the data set of requested data type over the time interval of the bucket.
List<DataSet> getDataSets()
Returns the requested data sets over the time interval of the bucket.
long getEndTimeMillis()
Returns the end time of the bucket, in milliseconds.
Session getSession()
Returns the session of the bucket if bucketing by session was requested, null otherwise.
long getStartTimeMillis()
Returns the start time of the bucket, in milliseconds.
int hashCode()
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int TYPE_ACTIVITY_SEGMENT

Type constant denoting that bucketing by individual activity segment is requested.

Constant Value: 4 (0x00000004)

public static final int TYPE_ACTIVITY_TYPE

Type constant denoting that bucketing by activity type is requested.

Constant Value: 3 (0x00000003)

public static final int TYPE_SESSION

Type constant denoting that bucketing by session is requested.

Constant Value: 2 (0x00000002)

public static final int TYPE_TIME

Type constant denoting that bucketing by time is requested.

Constant Value: 1 (0x00000001)

Fields

public static final Creator<Bucket> CREATOR

Public Methods

public int describeContents ()

public boolean equals (Object o)

public int getActivity ()

Returns the activity of the bucket if bucketing by activity was requested, UNKNOWN otherwise.

public int getBucketType ()

Returns the type of the bucket.

public DataSet getDataSet (DataType dataType)

Returns the data set of requested data type over the time interval of the bucket. Returns null, if data set for the requested type is not found.

public List<DataSet> getDataSets ()

Returns the requested data sets over the time interval of the bucket.

public long getEndTimeMillis ()

Returns the end time of the bucket, in milliseconds.

public Session getSession ()

Returns the session of the bucket if bucketing by session was requested, null otherwise.

public long getStartTimeMillis ()

Returns the start time of the bucket, in milliseconds.

public int hashCode ()

public String toString ()

public void writeToParcel (Parcel dest, int flags)