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 DataTypes
.
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 nanoseconds since
epoch.
| |||||||||||
Returns the original data source for this data point.
| |||||||||||
Returns the start time of the interval represented by this data point, in nanoseconds since
epoch.
| |||||||||||
Returns the timestamp of the data point, in nanoseconds 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 the data point in a given unit.
| |||||||||||
Sets the time interval for the data point, in case it represents an aggregation or average
over a period of time.
| |||||||||||
Sets the timestamp of the data point in a given unit.
| |||||||||||
Sets the timestamp of the data point, in case the data point represents 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 nanoseconds since
epoch. This method is equivalent to getTimestampNanos()
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 nanoseconds since epoch.
Returns the timestamp of the data point, in nanoseconds 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 the data point in a given unit.
See setTimeIntervalNanos(long, long)
for more details.
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 |
unit | the unit of both start and end timestamps |
Sets the time interval for the data point, in case it represents an aggregation or average
over a period of time. For data points that represent instantaneous samples,
setTimestampNanos(long)
should be used.
Examples of data types that represent intervals include:
startTimeNanos | the start time of the interval, in nanoseconds since epoch |
---|---|
endTimeNanos | the end time of the interval, in nanoseconds since epoch |
Sets the timestamp of the data point in a given unit.
See (long)
for more details.
timestamp | the timestamp in the given unit, representing elapsed time since epoch |
---|---|
unit | the unit of the given timestamp |
Sets the timestamp of the data point, in case the data point represents an instantaneous
reading, measurement, or input. For data points that represent intervals,
setTimeIntervalNanos(long, long)
should be used.
Examples of data types with instantaneous timestamp include:
timestampNanos | the time of the reading, in nanoseconds since epoch. |
---|