public final class

DataType

extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.fitness.data.DataType

Class Overview

The data type defines the schema for a stream of data being collected by, inserted into, or queried from Google Fit. 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.

The same underlying concept may be represented by different data types, depending on how data is represented. For example, the com.google.step_count.delta data type represents step count data as delta (new steps) between different readings, while the com.google.step_count.cumulative data type represents step count data as a sum since the start of the count. The platform has built-in support for converting between compatible data types.

A data type contains one or more fields. In case of multi-dimensional data (such as an accelerometer with x, y, and z axes) each field represents one dimension. Each data type field has a unique name which identifies it. The field also defines the format of the data (int, float, etc.).

The data types in the com.google namespace are shared with any app with the user consent. These are fixed and can only be updated in new releases of the platform. This class contains constants representing each of the com.google data types, each prefixed with TYPE_. Custom data types can be accessed via the ConfigApi.

Certain data types can represent aggregates, and can be computed as part of read requests by calling aggregate(DataType, DataType). This class contains constants for all the valid aggregates, each prefixed with AGGREGATE_. In addition, AGGREGATE_INPUT_TYPES contains all valid input types to aggregation, and the aggregates for each input type can be queried via getAggregatesForInput(DataType).

Summary

Constants
String MIME_TYPE_PREFIX The common prefix for data type MIME types, for use in intents.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final DataType AGGREGATE_ACTIVITY_SUMMARY In the com.google.activity.summary data type, each data point represents a summary of all activity segments of a particular activity type over a time interval.
public static final DataType AGGREGATE_DISTANCE_DELTA Aggregate distance, in meters, during a time interval.
public static final DataType AGGREGATE_HEART_RATE_SUMMARY In the com.google.heart_rate.summary data type, each data point represents average, maximum and minimum beats per minute over the time interval of the data point.
public static final Set<DataType> AGGREGATE_INPUT_TYPES List of data types that are supported as input data types for aggregation.
public static final DataType AGGREGATE_LOCATION_BOUNDING_BOX In the com.google.location.bounding_box data type, a data point represents the bounding box computed over user's location data points over a time interval.
public static final DataType AGGREGATE_POWER_SUMMARY In the com.google.power.summary data type, each data point represents average, maximum and minimum watts over the time interval of the data point.
public static final DataType AGGREGATE_SPEED_SUMMARY In the com.google.speed.summary data type, each data point represents the average, maximum and minimum speed over ground, in meters/second, over the time interval of the data point.
public static final DataType AGGREGATE_STEP_COUNT_DELTA Aggregate number of steps during a time interval.
public static final DataType AGGREGATE_WEIGHT_SUMMARY In the com.google.weight.summary data type, each data point represents the average, maximum and minimum weight, in kilograms, over the time interval of the data point.
public static final Creator<DataType> CREATOR
public static final DataType TYPE_ACTIVITY_SAMPLE In the com.google.activity.sample data type, each data point represents an instantaneous sample of the current activity.
public static final DataType TYPE_ACTIVITY_SEGMENT In the com.google.activity.segment data type, each data point represents a continuous time interval with a single activity value.
public static final DataType TYPE_CALORIES_CONSUMED In the com.google.calories.consumed data type, each data point represents the number of calories consumed, in kcal, over the time interval of the data point.
public static final DataType 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 DataType TYPE_CYCLING_PEDALING_CADENCE In the com.google.cycling,cadence data type, each data point represents an instantaneous measurement of the pedaling rate in crank revolutions per minute.
public static final DataType TYPE_CYCLING_PEDALING_CUMULATIVE In the com.google.cycling.pedaling.cumulative data type, each data point represents the number of rotations taken from the start of the count.
public static final DataType TYPE_CYCLING_WHEEL_REVOLUTION In the com.google.cycling.wheel_revolution.cumulative data type, each data point represents the number of revolutions taken from the start of the count.
public static final DataType TYPE_CYCLING_WHEEL_RPM In the com.google.cycling.wheel.revolutions data type, each data point represents an instantaneous measurement of the wheel in revolutions per minute.
public static final DataType 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 DataType TYPE_HEART_RATE_BPM In the com.google.heart_rate.bpm data type, each data point represents an instantaneous measurement of the heart rate in beats per minute.
public static final DataType TYPE_HEIGHT In the com.google.height data type, each data point represents the height of the user at the time of the reading, in meters.
public static final DataType TYPE_LOCATION_SAMPLE In the com.google.location.sample data type, each data point represents the user's location at a given instant.
public static final DataType TYPE_POWER_SAMPLE In the com.google.power.sample data type, each data point represents an instantaneous measurement of power in watts.
public static final DataType TYPE_SPEED In the com.google.speed data type, each data point represents the instantaneous speed over ground, in meters/second.
public static final DataType TYPE_STEP_COUNT_CADENCE In the com.google.step_count.cadence data type, each data point represents an instantaneous measurement of the cadence in steps per minute.
public static final DataType 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 static final DataType TYPE_WEIGHT In the com.google.weight data type, each data point represents the weight of the user at the time of the reading, in kilograms.
Public Methods
int describeContents()
boolean equals(Object that)
static List<DataType> getAggregatesForInput(DataType inputDataType)
Returns a list of output aggregate data types for the specified inputDataType.
List<Field> getFields()
Returns the ordered list of fields for the data type.
static String getMimeType(DataType dataType)
Returns the MIME type for a particular DataType.
String getName()
Returns the namespaced name which uniquely identifies this data type.
int hashCode()
int indexOf(Field field)
Return the index of a field
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String MIME_TYPE_PREFIX

The common prefix for data type MIME types, for use in intents. The MIME type for a particular data type will be this prefix followed by the data type name. Examples:

     vnd.google.fitness.data_type/com.google.heart_rate.bpm
     vnd.google.fitness.data_type/com.google.activity.segment
     vnd.google.fitness.data_type/com.example.my_type
 
The data type's name is returned by getName(). The full MIME type can be computed by getMimeType(DataType).

Constant Value: "vnd.google.fitness.data_type/"

Fields

public static final DataType AGGREGATE_ACTIVITY_SUMMARY

In the com.google.activity.summary data type, each data point represents a summary of all activity segments of a particular activity type over a time interval. The data type has three fields:

  1. activity an activity from FitnessActivities, as described in FIELD_ACTIVITY.
  2. duration an integer denoting the total time spent, in milliseconds, in this activity across all segments over the time interval of this data point
  3. num_segments number of distinct activity segments over the time interval of this data point

Because this is an aggregate data type, start and end times should be set.

public static final DataType AGGREGATE_DISTANCE_DELTA

Aggregate distance, in meters, during a time interval. This data type is equivalent to the one used for non-aggregated data. The full definition can be found at TYPE_DISTANCE_DELTA.

public static final DataType AGGREGATE_HEART_RATE_SUMMARY

In the com.google.heart_rate.summary data type, each data point represents average, maximum and minimum beats per minute over the time interval of the data point.

Because this is an aggregate data type, start and end times should be set.

public static final Set<DataType> AGGREGATE_INPUT_TYPES

List of data types that are supported as input data types for aggregation. These include:

Currently, data types outside of the com.google namespace cannot be aggregated by the platform.

public static final DataType AGGREGATE_LOCATION_BOUNDING_BOX

In the com.google.location.bounding_box data type, a data point represents the bounding box computed over user's location data points over a time interval. Each bounding box has four fields:

  1. low_latitude latitude of the lower left corner of the box, represented as a float, in degrees
  2. low_longitude longitude of the lower left corner of the box, represented as a float, in degrees
  3. high_latitude latitude of the upper right corner of the box, represented as a float, in degrees
  4. high_longitude longitude of the upper right corner of the box, represented as a float, in degrees
Because this is an aggregate data type, start and end times should be set.

public static final DataType AGGREGATE_POWER_SUMMARY

In the com.google.power.summary data type, each data point represents average, maximum and minimum watts over the time interval of the data point.

Because this is an aggregate data type, start and end times should be set.

public static final DataType AGGREGATE_SPEED_SUMMARY

In the com.google.speed.summary data type, each data point represents the average, maximum and minimum speed over ground, in meters/second, over the time interval of the data point.

Because this is an aggregate data type, the start and end times should be set.

public static final DataType AGGREGATE_STEP_COUNT_DELTA

Aggregate number of steps during a time interval. This data type is equivalent to the one used for non-aggregated data. The full definition can be found at TYPE_STEP_COUNT_DELTA.

public static final DataType AGGREGATE_WEIGHT_SUMMARY

In the com.google.weight.summary data type, each data point represents the average, maximum and minimum weight, in kilograms, over the time interval of the data point.

Because this is an aggregate data type, the start and end times should be set.

public static final Creator<DataType> CREATOR

public static final DataType TYPE_ACTIVITY_SAMPLE

In the com.google.activity.sample data type, each data point represents an instantaneous sample of the current activity. The data point has two fields, the first one representing the activity (as described in FIELD_ACTIVITY), and the second representing the confidence in the sample, specified as a float between 0.0 and 100.0. If the confidence is unknown or not calculated, a negative value can be used.

Because the samples are instantaneous, start time has no meaning and should be left unset.

It's possible that more than one activity is detected at the same time with different confidence values. This can be represented as multiple data points with the same timestamp but different field values.

public static final DataType TYPE_ACTIVITY_SEGMENT

In the com.google.activity.segment data type, each data point represents a continuous time interval with a single activity value. Activity values are described in FIELD_ACTIVITY.

The start time of the data point must always be present as it represents the start of the activity, with the timestamp representing the activity's end time. Data point time intervals should be non-overlapping, although they do not need to be contiguous. In case when two activities happen at the same time, the most significant one should be used.

public static final DataType TYPE_CALORIES_CONSUMED

In the com.google.calories.consumed data type, each data point represents the number of calories consumed, in kcal, over the time interval of the data point. The field value is stored as a float.

Start and end times should be set to denote the duration over which the calories were consumed.

public static final DataType 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.

Start and end times should be set to denote the duration over which the calories were expended.

public static final DataType TYPE_CYCLING_PEDALING_CADENCE

In the com.google.cycling,cadence data type, each data point represents an instantaneous measurement of the pedaling rate in crank revolutions per minute.

Start time should be left unset. Different data sources will need to monitor the rotations of the crank for different amounts of time before calculating the instantaneous RPM. This should be indicated as part of the data source and not the data point.

public static final DataType TYPE_CYCLING_PEDALING_CUMULATIVE

In the com.google.cycling.pedaling.cumulative data type, each data point represents the number of rotations taken from the start of the count. When using this data type, each revolution can be reported multiple times, as the values of each data point are monotonically increasing. To calculate the number of revolutions during an interval, the value at the end of the interval should be subtracted from the value at the beginning.

Note that the count may reset to zero at different times depending on the data source. When available, the data source should indicate the beginning of the count by setting the start time of the data point to the time of the start of the count. Alternatively, a data point with a value of zero can be used to indicate the resetting of the count. If neither of these is available, the count resetting can be inferred in a best-effort basis by detecting decreases in the total value.

public static final DataType TYPE_CYCLING_WHEEL_REVOLUTION

In the com.google.cycling.wheel_revolution.cumulative data type, each data point represents the number of revolutions taken from the start of the count. When using this data type, each revolution can be reported multiple times, as the values of each data point are monotonically increasing. To calculate the number of revolutions during an interval, the value at the end of the interval should be subtracted from the value at the beginning.

Note that the count may reset to zero at different times depending on the data source. When available, the data source should indicate the beginning of the count by setting the start time of the data point to the time of the start of the count. Alternatively, a data point with a value of zero can be used to indicate the resetting of the count. If neither of these is available, the count resetting can be inferred in a best-effort basis by detecting decreases in the total value.

public static final DataType TYPE_CYCLING_WHEEL_RPM

In the com.google.cycling.wheel.revolutions data type, each data point represents an instantaneous measurement of the wheel in revolutions per minute.

Start time should be left unset. Different data sources will need to monitor the RPMs for different amounts of time before calculating the instantaneous RPM. This should be indicated as part of the data source and not the data point.

public static final DataType 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.

public static final DataType TYPE_HEART_RATE_BPM

In the com.google.heart_rate.bpm data type, each data point represents an instantaneous measurement of the heart rate in beats per minute.

Start time should be left unset. Different data sources will need to monitor the heart's beat rate for different amounts of time before calculating the instantaneous heart rate. This should be indicated as part of the data source and not the data point.

public static final DataType TYPE_HEIGHT

In the com.google.height data type, each data point represents the height of the user at the time of the reading, in meters.

Because the recorded height is instantaneous, the start time should not be set.

public static final DataType TYPE_LOCATION_SAMPLE

In the com.google.location.sample data type, each data point represents the user's location at a given instant. The location data point has four fields:

  1. latitude is represented as a float, in degrees
  2. longitude is represented as a float, in degrees
  3. accuracy is represented as a float, in meters, and defines the radius of 68% confidence (so that it'd represent one standard deviation under a normal distribution) for latitude and longitude. See getAccuracy() for more details.
  4. altitude is represented as a float, in meters above sea level. Accuracy is unknown (not represented by accuracy). Most mobile devices produce measurements that are up to 25 meters away from the correct altitude, so care must be taken to average several results for increased accuracy or use another source for elevation information. If altitude could not be determined for this location sample, this field is not set.

public static final DataType TYPE_POWER_SAMPLE

In the com.google.power.sample data type, each data point represents an instantaneous measurement of power in watts. The field value is stored as a float.

Because the recorded power is instantaneous, the start time should not be set.

public static final DataType TYPE_SPEED

In the com.google.speed data type, each data point represents the instantaneous speed over ground, in meters/second. The value represents the scalar magnitude of the speed, so negative values should not occur.

Because the recorded speed is instantaneous, the start time should not be set.

public static final DataType TYPE_STEP_COUNT_CADENCE

In the com.google.step_count.cadence data type, each data point represents an instantaneous measurement of the cadence in steps per minute.

Both feet are used for calculating cadence, so if a sensor only measures one foot the value measurement is doubled.

Start time should be left unset. Different data sources will need to monitor the rotations of the crank for different amounts of time before calculating the instantaneous RPM. This should be indicated as part of the data source and not the data point.

public static final DataType 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.

public static final DataType TYPE_WEIGHT

In the com.google.weight data type, each data point represents the weight of the user at the time of the reading, in kilograms.

Because the recorded weight is instantaneous, the start time should not be set.

Public Methods

public int describeContents ()

public boolean equals (Object that)

public static List<DataType> getAggregatesForInput (DataType inputDataType)

Returns a list of output aggregate data types for the specified inputDataType.

public List<Field> getFields ()

Returns the ordered list of fields for the data type.

public static String getMimeType (DataType dataType)

Returns the MIME type for a particular DataType. The MIME type is used in intents such as the data view intent.

public String getName ()

Returns the namespaced name which uniquely identifies this data type.

public int hashCode ()

public int indexOf (Field field)

Return the index of a field

public String toString ()

public void writeToParcel (Parcel dest, int flags)