java.lang.Object | |
↳ | com.google.android.gms.fitness.data.Field |
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 withFIELD_
. These can be used to access and set the fields via
DataPoint.getValue(Field)
.
Fields for custom data types can be created using
addField(String, int)
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 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_VITAMIN_A | Vitamin A amount in International Units (IU). | |||||||||
String | NUTRIENT_VITAMIN_C | Vitamin C amount in milligrams. |
[Expand]
Inherited Constants | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FIELD_ACCURACY | The accuracy of an accompanied value (such as location). | ||||||||||
FIELD_ACTIVITY |
An activity type of FitnessActivities , encoded as an integer for efficiency.
|
||||||||||
FIELD_ALTITUDE | An altitude of a location represented as a float, in meters above sea level. | ||||||||||
FIELD_AVERAGE | An average value. | ||||||||||
FIELD_BPM | A heart rate in beats per minute. | ||||||||||
FIELD_CALORIES | Calories in kcal. | ||||||||||
FIELD_CIRCUMFERENCE | Circumference of a body part, in centimeters. | ||||||||||
FIELD_CONFIDENCE | The confidence of an accompanied value, specified as a value between 0.0 and 100.0. | ||||||||||
FIELD_DISTANCE | A distance in meters. | ||||||||||
FIELD_DURATION | A duration in milliseconds. | ||||||||||
FIELD_FOOD_ITEM | The corresponding food item for a nutrition entry. | ||||||||||
FIELD_HEIGHT | A height in meters. | ||||||||||
FIELD_HIGH_LATITUDE | A high latitude of a location bounding box represented as a float, in degrees. | ||||||||||
FIELD_HIGH_LONGITUDE | A high longitude of a location bounding box represented as a float, in degrees. | ||||||||||
FIELD_LATITUDE | A latitude of a location represented as a float, in degrees. | ||||||||||
FIELD_LONGITUDE | A longitude of a location represented as a float, in degrees. | ||||||||||
FIELD_LOW_LATITUDE | A low latitude of a location bounding box represented as a float, in degrees. | ||||||||||
FIELD_LOW_LONGITUDE | A low longitude of a location bounding box represented as a float, in degrees. | ||||||||||
FIELD_MAX | A maximum value. | ||||||||||
FIELD_MEAL_TYPE | Type of meal, represented as the appropriate int constant. | ||||||||||
FIELD_MIN | A minimum value. | ||||||||||
FIELD_NUM_SEGMENTS | A number of segments. | ||||||||||
FIELD_NUTRIENTS | Nutrients ingested by the user, represented as a float map of nutrient key to quantity. | ||||||||||
FIELD_PERCENTAGE | A percentage value, between 0 and 100. | ||||||||||
FIELD_REVOLUTIONS | A count of revolutions. | ||||||||||
FIELD_RPM | Revolutions per minute or rate per minute. | ||||||||||
FIELD_SPEED | A speed in meter/sec. | ||||||||||
FIELD_STEPS | A count of steps. | ||||||||||
FIELD_WATTS | Power in watts. | ||||||||||
FIELD_WEIGHT | A weight in kilograms. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the format of the field, as one of the format constant values.
| |||||||||||
Returns the name of the field.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||||||||||||||||||||||||
From interface
android.os.Parcelable
|
Format constant indicating the field holds float values.
Format constant indicating the field holds integer values.
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 setKeyValue(String, float)
and read using
getKeyValue(String)
.
Keys should be kept small whenever possible. Data streams with large keys and high data frequency may be down sampled.
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.
Meal type constant representing a breakfast meal.
Meal type constant representing a dinner meal.
Meal type constant representing a lunch meal.
Meal type constant representing a snack meal.
Meal type constant representing the meal type is unknown
Calcium amount in milligrams.
Calories in kcal.
Cholesterol in milligrams.
Dietary fiber in grams.
Iron amount in milligrams.
Monounsaturated fat in grams.
Polyunsaturated fat in grams.
Potassium in milligrams.
Protein amount in grams.
Saturated fat in grams.
Sodium in milligrams.
Sugar amount in grams.
Total carbohydrates in grams.
Total fat in grams.
Trans fat in grams.
Vitamin A amount in International Units (IU). For converting from daily percentages, the FDA recommended 5000 IUs Daily Value can be used.
Vitamin C amount in milligrams.
An activity type of FitnessActivities
, encoded as an integer for efficiency. The
activity value should be stored using setActivity(String)
,
and read using asActivity()
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.
The confidence of an accompanied value, specified as a value between 0.0 and 100.0.
A high latitude of a location bounding box represented as a float, in degrees.
A high longitude of a location bounding box represented as a float, in degrees.
A latitude of a location represented as a float, in degrees.
A longitude of a location represented as a float, in degrees.
A low latitude of a location bounding box represented as a float, in degrees.
A low longitude of a location bounding box represented as a float, in degrees.
Type of meal, represented as the appropriate int constant.
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.
Returns the format of the field, as one of the format constant values.
Returns the name of the field.