A field represents one dimension of a data type. It defines the name and format of data. Unlike data type names, field names are not namespaced, and only need to be unique within the data type.
This class contains constants representing the field names of common data types, each
prefixed with FIELD_
. These can be used to access and set the fields via
DataPoint.getValue(Field)
.
Fields for custom data types can be created using
DataTypeCreateRequest.Builder.addField(String, int)
.
Constant Summary
int | FORMAT_FLOAT | Format constant indicating the field holds float values. |
int | FORMAT_INT32 | Format constant indicating the field holds integer values. |
int | FORMAT_MAP | Format constant indicating the field holds a map of string keys to values. |
int | FORMAT_STRING | Format constant indicating the field holds string values. |
int | MEAL_TYPE_BREAKFAST | Meal type constant representing a breakfast meal. |
int | MEAL_TYPE_DINNER | Meal type constant representing a dinner meal. |
int | MEAL_TYPE_LUNCH | Meal type constant representing a lunch meal. |
int | MEAL_TYPE_SNACK | Meal type constant representing a snack meal. |
int | MEAL_TYPE_UNKNOWN | Meal type constant representing that the meal type is unknown. |
String | NUTRIENT_CALCIUM | Calcium amount in milligrams. |
String | NUTRIENT_CALORIES | Calories in kcal. |
String | NUTRIENT_CHOLESTEROL | Cholesterol in milligrams. |
String | NUTRIENT_DIETARY_FIBER | Dietary fiber in grams. |
String | NUTRIENT_IRON | Iron amount in milligrams. |
String | NUTRIENT_MONOUNSATURATED_FAT | Monounsaturated fat in grams. |
String | NUTRIENT_POLYUNSATURATED_FAT | Polyunsaturated fat in grams. |
String | NUTRIENT_POTASSIUM | Potassium in milligrams. |
String | NUTRIENT_PROTEIN | Protein amount in grams. |
String | NUTRIENT_SATURATED_FAT | Saturated fat in grams. |
String | NUTRIENT_SODIUM | Sodium in milligrams. |
String | NUTRIENT_SUGAR | Sugar amount in grams. |
String | NUTRIENT_TOTAL_CARBS | Total carbohydrates in grams. |
String | NUTRIENT_TOTAL_FAT | Total fat in grams. |
String | NUTRIENT_TRANS_FAT | Trans fat in grams. |
String | NUTRIENT_UNSATURATED_FAT | Unsaturated fat in grams. |
String | NUTRIENT_VITAMIN_A | Vitamin A amount in International Units (IU). |
String | NUTRIENT_VITAMIN_C | Vitamin C amount in milligrams. |
int | RESISTANCE_TYPE_BARBELL | The user is using a barbell for resistance. |
int | RESISTANCE_TYPE_BODY | The user is using their own body weight for resistance. |
int | RESISTANCE_TYPE_CABLE | The user is using a cable for resistance. |
int | RESISTANCE_TYPE_DUMBBELL | The user is using dumbells for resistance. |
int | RESISTANCE_TYPE_KETTLEBELL | The user is using a kettlebell for resistance. |
int | RESISTANCE_TYPE_MACHINE | The user is performing the exercise in a machine. |
int | RESISTANCE_TYPE_UNKNOWN | The resistance type is unknown, unspecified, or not represented by any canonical values. |
Inherited Constant Summary
Field Summary
public static final Field | FIELD_ACCURACY | The accuracy of an accompanied value (such as location). |
public static final Field | FIELD_ACTIVITY | An activity type of FitnessActivities ,
encoded as an integer for efficiency. |
public static final Field | FIELD_ALTITUDE | An altitude of a location represented as a float, in meters above sea level. |
public static final Field | FIELD_AVERAGE | An average value. |
public static final Field | FIELD_BPM | A heart rate in beats per minute. |
public static final Field | FIELD_CALORIES | Calories in kcal. |
public static final Field | FIELD_CIRCUMFERENCE | This field is deprecated. There is no applicable replacement field. |
public static final Field | FIELD_CONFIDENCE | The confidence of an accompanied value, specified as a value between 0.0 and 100.0. |
public static final Field | FIELD_DISTANCE | A distance in meters. |
public static final Field | FIELD_DURATION | A field containing duration. |
public static final Field | FIELD_EXERCISE | A workout exercise, as represented by one of the
constants in WorkoutExercises . |
public static final Field | FIELD_FOOD_ITEM | The corresponding food item for a nutrition entry. |
public static final Field | FIELD_HEIGHT | A height in meters. |
public static final Field | FIELD_HIGH_LATITUDE | A high latitude of a location bounding box represented as a float, in degrees. |
public static final Field | FIELD_HIGH_LONGITUDE | A high longitude of a location bounding box represented as a float, in degrees. |
public static final Field | FIELD_INTENSITY | Intensity of user activity, represented as a float. |
public static final Field | FIELD_LATITUDE | A latitude of a location represented as a float, in degrees. |
public static final Field | FIELD_LONGITUDE | A longitude of a location represented as a float, in degrees. |
public static final Field | FIELD_LOW_LATITUDE | A low latitude of a location bounding box represented as a float, in degrees. |
public static final Field | FIELD_LOW_LONGITUDE | A low longitude of a location bounding box represented as a float, in degrees. |
public static final Field | FIELD_MAX | A maximum value. |
public static final Field | FIELD_MAX_INT | A maximum int value. |
public static final Field | FIELD_MEAL_TYPE | Type of meal, represented as the appropriate int constant. |
public static final Field | FIELD_MIN | A minimum value. |
public static final Field | FIELD_MIN_INT | A minimum int value. |
public static final Field | FIELD_NUM_SEGMENTS | A number of segments. |
public static final Field | FIELD_NUTRIENTS | Nutrients ingested by the user, represented as a float map of nutrient key to quantity. |
public static final Field | FIELD_OCCURRENCES | How many occurrences of an event there were in a time range. |
public static final Field | FIELD_PERCENTAGE | A percentage value, between 0 and 100. |
public static final Field | FIELD_REPETITIONS | A count of repetitions for a single set of a workout exercise. |
public static final Field | FIELD_RESISTANCE | The resistance of the exercise (or weight), in kg. |
public static final Field | FIELD_RESISTANCE_TYPE | The type of resistance used in this exercise, represented as the appropriate int constant. |
public static final Field | FIELD_REVOLUTIONS | A count of revolutions. |
public static final Field | FIELD_RPM | Revolutions per minute or rate per minute. |
public static final Field | FIELD_SLEEP_SEGMENT_TYPE | Sleep Segment type defined in SleepStages . |
public static final Field | FIELD_SPEED | A speed in meter/sec. |
public static final Field | FIELD_STEPS | A count of steps. |
public static final Field | FIELD_STEP_LENGTH | This field is deprecated. There is no applicable replacement field. |
public static final Field | FIELD_VOLUME | Volume in liters. |
public static final Field | FIELD_WATTS | Power in watts. |
public static final Field | FIELD_WEIGHT | A weight in kilograms. |
Public Method Summary
boolean | |
int |
getFormat()
Returns the format of the field, as one of the format constant values.
|
String |
getName()
Returns the name of the field.
|
int |
hashCode()
|
Boolean | |
String |
toString()
|
void |
writeToParcel(Parcel dest, int
flags)
|
Inherited Method Summary
Constants
public static final int FORMAT_FLOAT
Format constant indicating the field holds float values.
public static final int FORMAT_INT32
Format constant indicating the field holds integer values.
public static final int FORMAT_MAP
Format constant indicating the field holds a map of string keys to values. The valid key space and units for the corresponding value should be documented as part of the data type definition.
Map values can be set using
DataPoint.Builder.setField(com.google.android.gms.fitness.data.Field,
java.util.Map)
.
Keys should be kept small whenever possible. Data streams with large keys and high data frequency may be down sampled.
public static final int FORMAT_STRING
Format constant indicating the field holds string values. Strings should be kept small whenever possible. Data streams with large string values and high data frequency may be down sampled.
public static final int MEAL_TYPE_BREAKFAST
Meal type constant representing a breakfast meal.
public static final int MEAL_TYPE_DINNER
Meal type constant representing a dinner meal.
public static final int MEAL_TYPE_LUNCH
Meal type constant representing a lunch meal.
public static final int MEAL_TYPE_SNACK
Meal type constant representing a snack meal.
public static final int MEAL_TYPE_UNKNOWN
Meal type constant representing that the meal type is unknown.
public static final String NUTRIENT_CALCIUM
Calcium amount in milligrams.
public static final String NUTRIENT_CALORIES
Calories in kcal.
public static final String NUTRIENT_CHOLESTEROL
Cholesterol in milligrams.
public static final String NUTRIENT_DIETARY_FIBER
Dietary fiber in grams.
public static final String NUTRIENT_IRON
Iron amount in milligrams.
public static final String NUTRIENT_MONOUNSATURATED_FAT
Monounsaturated fat in grams.
public static final String NUTRIENT_POLYUNSATURATED_FAT
Polyunsaturated fat in grams.
public static final String NUTRIENT_POTASSIUM
Potassium in milligrams.
public static final String NUTRIENT_PROTEIN
Protein amount in grams.
public static final String NUTRIENT_SATURATED_FAT
Saturated fat in grams.
public static final String NUTRIENT_SODIUM
Sodium in milligrams.
public static final String NUTRIENT_SUGAR
Sugar amount in grams.
public static final String NUTRIENT_TOTAL_CARBS
Total carbohydrates in grams.
public static final String NUTRIENT_TOTAL_FAT
Total fat in grams.
public static final String NUTRIENT_TRANS_FAT
Trans fat in grams.
public static final String NUTRIENT_UNSATURATED_FAT
Unsaturated fat in grams.
public static final String NUTRIENT_VITAMIN_A
Vitamin A amount in International Units (IU). For converting from daily percentages, the FDA recommended 5000 IUs Daily Value can be used.
public static final String NUTRIENT_VITAMIN_C
Vitamin C amount in milligrams.
public static final int RESISTANCE_TYPE_BARBELL
The user is using a barbell for resistance. The specified resistance should include the weight of the bar, as well as weights added to both sides.
public static final int RESISTANCE_TYPE_BODY
The user is using their own body weight for resistance.
public static final int RESISTANCE_TYPE_CABLE
The user is using a cable for resistance. When two cables are being used (one for each arm), the specified resistance should include the weight being pulled by one cable.
public static final int RESISTANCE_TYPE_DUMBBELL
The user is using dumbells for resistance. The specified resistance should include the weight of a single dumbell.
public static final int RESISTANCE_TYPE_KETTLEBELL
The user is using a kettlebell for resistance.
public static final int RESISTANCE_TYPE_MACHINE
The user is performing the exercise in a machine. The specified resistance should match the weight specified by the machine.
public static final int RESISTANCE_TYPE_UNKNOWN
The resistance type is unknown, unspecified, or not represented by any canonical values.
Fields
public static final Field FIELD_ACCURACY
The accuracy of an accompanied value (such as location).
public static final Field FIELD_ACTIVITY
An activity type of FitnessActivities
,
encoded as an integer for efficiency. The activity value should be stored using
DataPoint.Builder.setActivityField(Field, String)
.
public static final Field FIELD_ALTITUDE
An altitude of a location represented as a float, in meters above sea level. Some location samples don't have an altitude value so this field might not be set.
public static final Field FIELD_AVERAGE
An average value.
public static final Field FIELD_BPM
A heart rate in beats per minute.
public static final Field FIELD_CALORIES
Calories in kcal.
public static final Field FIELD_CIRCUMFERENCE
This field is deprecated.
There is no applicable replacement field.
Circumference of a body part, in centimeters.
public static final Field FIELD_CONFIDENCE
The confidence of an accompanied value, specified as a value between 0.0 and 100.0.
public static final Field FIELD_DISTANCE
A distance in meters.
public static final Field FIELD_DURATION
A field containing duration. The units of the field are defined by the outer data type.
public static final Field FIELD_EXERCISE
A workout exercise, as represented by one of the constants in WorkoutExercises
.
public static final Field FIELD_FOOD_ITEM
The corresponding food item for a nutrition entry.
public static final Field FIELD_HEIGHT
A height in meters.
public static final Field FIELD_HIGH_LATITUDE
A high latitude of a location bounding box represented as a float, in degrees.
public static final Field FIELD_HIGH_LONGITUDE
A high longitude of a location bounding box represented as a float, in degrees.
public static final Field FIELD_INTENSITY
Intensity of user activity, represented as a float. Scales:
- Light exercise of one minute -> 1 unit
- Intense exercise of one minute -> 2 units
public static final Field FIELD_LATITUDE
A latitude of a location represented as a float, in degrees.
public static final Field FIELD_LONGITUDE
A longitude of a location represented as a float, in degrees.
public static final Field FIELD_LOW_LATITUDE
A low latitude of a location bounding box represented as a float, in degrees.
public static final Field FIELD_LOW_LONGITUDE
A low longitude of a location bounding box represented as a float, in degrees.
public static final Field FIELD_MAX
A maximum value.
public static final Field FIELD_MAX_INT
A maximum int value.
public static final Field FIELD_MEAL_TYPE
Type of meal, represented as the appropriate int constant.
public static final Field FIELD_MIN
A minimum value.
public static final Field FIELD_MIN_INT
A minimum int value.
public static final Field FIELD_NUM_SEGMENTS
A number of segments.
public static final Field FIELD_NUTRIENTS
Nutrients ingested by the user, represented as a float map of nutrient key to
quantity. The valid keys of the map are listed in this class using the
NUTRIENT_
prefix. The documentation for each key describes the unit of its
value.
public static final Field FIELD_OCCURRENCES
How many occurrences of an event there were in a time range. For sample data types this should not be set to more than one.
public static final Field FIELD_PERCENTAGE
A percentage value, between 0 and 100.
public static final Field FIELD_REPETITIONS
A count of repetitions for a single set of a workout exercise.
public static final Field FIELD_RESISTANCE
The resistance of the exercise (or weight), in kg.
public static final Field FIELD_RESISTANCE_TYPE
The type of resistance used in this exercise, represented as the appropriate int constant.
public static final Field FIELD_REVOLUTIONS
A count of revolutions.
public static final Field FIELD_RPM
Revolutions per minute or rate per minute.
public static final Field FIELD_SLEEP_SEGMENT_TYPE
Sleep Segment type defined in SleepStages
.
public static final Field FIELD_SPEED
A speed in meter/sec.
public static final Field FIELD_STEPS
A count of steps.
public static final Field FIELD_STEP_LENGTH
This field is deprecated.
There is no applicable replacement field.
Distance between steps in meters.
public static final Field FIELD_VOLUME
Volume in liters.
public static final Field FIELD_WATTS
Power in watts.
public static final Field FIELD_WEIGHT
A weight in kilograms.
Public Methods
public boolean equals (Object other)
public int getFormat ()
Returns the format of the field, as one of the format constant values.
public String getName ()
Returns the name of the field.