java.lang.Object | |
↳ | com.google.android.gms.fitness.data.DataPoint |
Represents a single data point in a data type's
stream from a particular
data source
. A data point holds a value for each field, a timestamp and an
optional start time. The exact semantics of each of these attributes is specified in the
documentation for the particular data type, which can be found in the appropriate constant in
DataType
.
A data point can represent an instantaneous measurement, reading or inputted observation, as well as averages or aggregates over a time interval. Check the data type documentation to determine which is the case for a particular data type.
DataPoints always contain one value for each the data type
field
.
Initially, all of the values are unset. After creating the data point, the appropriate values
and timestamps should be set.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new data point for the given
dataSource .
| |||||||||||
Extracts a data point from a callback intent received after registering to a data source
with a PendingIntent.
| |||||||||||
Returns the data source for the data point.
| |||||||||||
Returns the data type defining the format of the values in this data point.
| |||||||||||
Returns the end time of the interval represented by this data point, in the given unit since
epoch.
| |||||||||||
Returns the original data source for this data point.
| |||||||||||
Returns the start time of the interval represented by this data point,
in the given unit since epoch.
| |||||||||||
Returns the timestamp of the data point, in the given unit since epoch.
| |||||||||||
Returns the value holder for the field with the given name.
| |||||||||||
Sets the values of this data point, where the format for all of its values is float.
| |||||||||||
Sets the values of this data point, where the format for all of its values is int.
| |||||||||||
Sets the time interval of a data point that represents an interval of time.
| |||||||||||
Sets the timestamp of a data point that represent an instantaneous reading,
measurement, or input.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Extracts a data point from a callback intent received after registering to a data source with a PendingIntent.
null
if the given intent does not contain a
DataPoint
Returns the data source for the data point. If the data point is part of a DataSet
,
this will correspond to the data set's data source.
Returns the data type defining the format of the values in this data point.
Returns the end time of the interval represented by this data point, in the given unit since
epoch. This method is equivalent to getTimestamp(TimeUnit)
Returns the original data source for this data point. The original data source helps identify the source of the data point as it gets merged and transformed into different streams.
Note that, if this data point is part of a DataSet
, the data source returned here
may be different from the data set's data source. In case of transformed or merged data
sets, each data point's original data source will retain the original attribution as much
as possible, while the data set's data source will represent the merged or transformed
stream.
Returns the start time of the interval represented by this data point, in the given unit since epoch.
Returns the timestamp of the data point, in the given unit since epoch. For data points that represent intervals, this method will return the end time.
Returns the value holder for the field with the given name. This method can be used both to query the value and to set it.
field | one of the fields of this data type |
---|
IllegalArgumentException | if the given field doesn't match any of the fields for this DataPoint's data type. |
---|
Sets the values of this data point, where the format for all of its values is float.
values | the value for each field of the data point, in order |
---|
Sets the values of this data point, where the format for all of its values is int.
values | the value for each field of the data point, in order |
---|
Sets the time interval of a data point that represents an interval of time. For data points
that represent instantaneous readings, setTimestamp(long, TimeUnit)
should be used.
Examples of data types that represent intervals include:
Google Fit accepts timestamps with up to nanosecond granularity.startTime | the start time in the given unit, representing elapsed time since epoch |
---|---|
endTime | the end time in the given unit, representing elapsed time since epoch |
timeUnit | the time unit of both start and end timestamps |
Sets the timestamp of a data point that represent an instantaneous reading,
measurement, or input. For data points that represent intervals,
setTimeInterval(long, long, TimeUnit)
should be used.
Examples of data types with instantaneous timestamp include:
Google Fit accepts timestamps with up to nanosecond granularity for allDataTypes
with the exception of location
, which supports only timestamps with millisecond precision. If the timestamp has
more than millisecond granularity for a location, the extra precision will be lost.timestamp | the timestamp in the given unit, representing elapsed time since epoch |
---|---|
timeUnit | the unit of the given timestamp |