LocalDataType

public final classLocalDataTypeextendsObject

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 containsLocalFields. 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 finalLocalDataType TYPE_CALORIES_EXPENDED In thecom.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 finalLocalDataType TYPE_DISTANCE_DELTA In thecom.google.distance.delta data type, each data point represents the distance covered, in meters,since the last reading.
public static finalLocalDataType TYPE_STEP_COUNT_DELTA In thecom.google.step_count.delta data type, each data point represents the number of steps takensince 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
int
indexOf(LocalField field)
Returns the index of a field.
String

Inherited Method Summary

Fields

public static final LocalDataType TYPE_CALORIES_EXPENDED

In thecom.google.calories.expendeddata 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_RECOGNITIONruntime permission.

public static final LocalDataType TYPE_DISTANCE_DELTA

In thecom.google.distance.deltadata 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_RECOGNITIONruntime permission.

public static final LocalDataType TYPE_STEP_COUNT_DELTA

In thecom.google.step_count.deltadata type, each data point represents the number of steps takensince 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_RECOGNITIONruntime permission.

Public Methods

public booleanequals(Objectother)

publicList<LocalField> getFields()

Returns the ordered list of fields for the data type.

publicStringgetName()

Returns the namespaced name which uniquely identifies this data type.

public inthashCode()

public intindexOf(LocalField field)

Returns the index of a field.

Throws
IllegalArgumentException Iffieldisn't defined for this data type.

publicStringtoString()