The data type defines the schema for a stream of data being collected by or queried from the Recording API on mobile. The data type defines only the representation and format of the data, and not how it's being collected, the sensor being used, or the parameters of the collection.
A data type contains LocalField
s.
The field defines the format of the data (such as int or float).
Data types can be aggregates, and can be computed as part of read requests by calling
LocalDataReadRequest.Builder.aggregate(LocalDataType)
.
Field Summary
public static final LocalDataType | TYPE_CALORIES_EXPENDED | In the com.google.calories.expended
data type, each data point represents the number of calories expended, in kcal, over
the time interval of the data point. |
public static final LocalDataType | TYPE_DISTANCE_DELTA | In the com.google.distance.delta
data type, each data point represents the distance covered, in meters, since
the last reading. |
public static final LocalDataType | TYPE_STEP_COUNT_DELTA | In the com.google.step_count.delta
data type, each data point represents the number of steps taken since the
last reading. |
Public Method Summary
boolean | |
List<LocalField> |
getFields()
Returns the ordered list of fields for the data type.
|
String |
getName()
Returns the namespaced name which uniquely identifies this data type.
|
int |
hashCode()
|
int | |
String |
toString()
|
Inherited Method Summary
Fields
public static final LocalDataType TYPE_CALORIES_EXPENDED
In the com.google.calories.expended
data type, each data point
represents the number of calories expended, in kcal, over the time interval of the data
point. The field value is stored as a float. Note: this total calories number includes
BMR calories expended.
Start and end times should be set to denote the duration over which the calories were expended.
From API level 29, recording data of this type requires the
ACTIVITY_RECOGNITION
runtime permission.
public static final LocalDataType TYPE_DISTANCE_DELTA
In the com.google.distance.delta
data type, each data point represents
the distance covered, in meters, since the last reading. The total
distance over an interval can be calculated by adding together all the values during
the interval.
The start time of each data point should represent the start of the interval in which the distance was covered. The start time must be equal to or greater than the end time of the previous data point.
Registering to, or subscribing to data of this type requires
Manifest.permission.ACCESS_FINE_LOCATION
.
From API level 29, recording data of this type requires the
ACTIVITY_RECOGNITION
runtime permission.
public static final LocalDataType TYPE_STEP_COUNT_DELTA
In the com.google.step_count.delta
data type, each data point
represents the number of steps taken since the last reading. When
using this data type, each step is only ever reported once, in the reading immediately
succeeding the step. By adding all of the values together for a period of time, the
total number of steps during that period can be computed.
As an example, if a user walked a total of 5 steps, with 3 different readings, the values for each reading might be [1, 2, 2].
The start time of each data point should represent the start of the interval in which steps were taken. The start time must be equal to or greater than the end time of the previous data point.
From API level 29, recording data of this type requires the
ACTIVITY_RECOGNITION
runtime permission.
Public Methods
public boolean equals (Object other)
public List<LocalField> getFields ()
Returns the ordered list of fields for the data type.
public String getName ()
Returns the namespaced name which uniquely identifies this data type.
public int hashCode ()
public int indexOf (LocalField field)
Returns the index of a field.
Throws
IllegalArgumentException | If field isn't defined for this data type. |
---|