LocalBucket
Stay organized with collections
Save and categorize content based on your preferences.
A bucket represents a time interval over which aggregated data is computed. For example, a
bucket can represent user's step count over a 1 hour interval. We allow buckets to be
computed by time, where a time bucket can represent a full day, hour, or any other desired
interval.
A bucket consists of the following fields:
-
startTime
denotes the start time of the bucket. This field is always
present.
-
endTime
denotes the end time of the bucket. This field is always
present.
-
dataSets
LocalDataSet
for the aggregated LocalDataType
requested in the read query over the time interval of this bucket.
Constant Summary
int |
TYPE_TIME
|
Type constant denoting that bucketing by time is
requested. |
Inherited Method Summary
From class java.lang.Object
Constants
public static final int
TYPE_TIME
Type constant denoting that bucketing by time is requested.
Constant Value:
1
Public Methods
public boolean
equals
( Object
other)
public int
getBucketType
()
Returns the type of the bucket.
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.
Returns the requested data sets over the time interval of the bucket.
public long
getEndTime
( TimeUnit
timeUnit)
Returns the end time of the bucket, in the given time unit since epoch.
public long
getStartTime
( TimeUnit
timeUnit)
Returns the start time of the bucket, in the given time unit since epoch.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLocalBucket\u003c/code\u003e represents a time interval for aggregated data, like step count over an hour.\u003c/p\u003e\n"],["\u003cp\u003eBuckets are defined by \u003ccode\u003estartTime\u003c/code\u003e and \u003ccode\u003eendTime\u003c/code\u003e and contain \u003ccode\u003edataSets\u003c/code\u003e for aggregated data.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetDataSet()\u003c/code\u003e and \u003ccode\u003egetDataSets()\u003c/code\u003e methods retrieve data sets within the bucket's time frame.\u003c/p\u003e\n"],["\u003cp\u003eBuckets can be created based on time intervals such as days, hours, or other custom durations.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetStartTime()\u003c/code\u003e and \u003ccode\u003egetEndTime()\u003c/code\u003e return the bucket's boundaries in the desired time unit.\u003c/p\u003e\n"]]],[],null,["# LocalBucket\n\npublic class **LocalBucket** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nA bucket represents a time interval over which aggregated data is computed. For example, a\nbucket can represent user's step count over a 1 hour interval. We allow buckets to be\ncomputed by time, where a time bucket can represent a full day, hour, or any other desired\ninterval.\n\nA bucket consists of the following fields:\n\n- `startTime` denotes the start time of the bucket. This field is always present.\n- `endTime` denotes the end time of the bucket. This field is always present.\n- `dataSets` [LocalDataSet](/android/reference/com/google/android/gms/fitness/data/LocalDataSet) for the aggregated [LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType) requested in the read query over the time interval of this bucket. \n\n### Constant Summary\n\n|-----|-------------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| int | [TYPE_TIME](/android/reference/com/google/android/gms/fitness/data/LocalBucket#TYPE_TIME) | Type constant denoting that bucketing by time is requested. |\n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/android/reference/com/google/android/gms/fitness/data/LocalBucket#equals(java.lang.Object))([Object](//developer.android.com/reference/java/lang/Object.html) other) |\n| int | [getBucketType](/android/reference/com/google/android/gms/fitness/data/LocalBucket#getBucketType())() Returns the type of the bucket. |\n| [LocalDataSet](/android/reference/com/google/android/gms/fitness/data/LocalDataSet) | [getDataSet](/android/reference/com/google/android/gms/fitness/data/LocalBucket#getDataSet(com.google.android.gms.fitness.data.LocalDataType))([LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType) dataType) Returns the data set of requested data type over the time interval of the bucket. |\n| [List](//developer.android.com/reference/java/util/List.html)\\\u003c[LocalDataSet](/android/reference/com/google/android/gms/fitness/data/LocalDataSet)\\\u003e | [getDataSets](/android/reference/com/google/android/gms/fitness/data/LocalBucket#getDataSets())() Returns the requested data sets over the time interval of the bucket. |\n| long | [getEndTime](/android/reference/com/google/android/gms/fitness/data/LocalBucket#getEndTime(java.util.concurrent.TimeUnit))([TimeUnit](//developer.android.com/reference/java/util/concurrent/TimeUnit.html) timeUnit) Returns the end time of the bucket, in the given time unit since epoch. |\n| long | [getStartTime](/android/reference/com/google/android/gms/fitness/data/LocalBucket#getStartTime(java.util.concurrent.TimeUnit))([TimeUnit](//developer.android.com/reference/java/util/concurrent/TimeUnit.html) timeUnit) Returns the start time of the bucket, in the given time unit since epoch. |\n| int | [hashCode](/android/reference/com/google/android/gms/fitness/data/LocalBucket#hashCode())() |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/fitness/data/LocalBucket#toString())() |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nConstants\n---------\n\n#### public static final int\n**TYPE_TIME**\n\nType constant denoting that bucketing by time is requested. \nConstant Value: 1\n\nPublic Methods\n--------------\n\n#### public boolean **equals** ([Object](//developer.android.com/reference/java/lang/Object.html) other)\n\n#### public int **getBucketType** ()\n\nReturns the type of the bucket. \n\n#### public [LocalDataSet](/android/reference/com/google/android/gms/fitness/data/LocalDataSet)\n**getDataSet** ([LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType) dataType)\n\nReturns the data set of requested data type over the time interval of the bucket.\nReturns null, if data set for the requested type is not found. \n\n#### public [List](//developer.android.com/reference/java/util/List.html)\\\u003c[LocalDataSet](/android/reference/com/google/android/gms/fitness/data/LocalDataSet)\\\u003e\n**getDataSets** ()\n\nReturns the requested data sets over the time interval of the bucket. \n\n#### public long **getEndTime** ([TimeUnit](//developer.android.com/reference/java/util/concurrent/TimeUnit.html) timeUnit)\n\nReturns the end time of the bucket, in the given time unit since epoch. \n\n#### public long **getStartTime** ([TimeUnit](//developer.android.com/reference/java/util/concurrent/TimeUnit.html) timeUnit)\n\nReturns the start time of the bucket, in the given time unit since epoch. \n\n#### public int **hashCode** ()\n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **toString** ()"]]