Fitness Data Types

Google Fit provides a set of fitness data types under the com.google namespace. Data types define the format of the values inside data points. A data point can represent:

  • An instantaneous reading or observation
  • An aggregate with statistics over a time interval

Google Fit defines data types for instantaneous observations and data types for aggregate data. Data points consist of values for the fields of a data type and timestamp information. Points that represent instantaneous observations include a timestamp, and points of an aggregate data type also include a timestamp for the start of the interval.

Google Fit enables you to define new data types in your app and to share your new data types with other apps.

For more information about inserting data points, see Add points to a dataset.

Data types

There are three kinds of data types in Google Fit:

Public data types

Standard data types provided by the platform, like com.google.step_count.delta. Any app can read and write data of these types.
For more information, see Public Data Types.

Private custom data types

Custom data types defined by a specific app. Only the app that defines the data type can read and write data of this type.
For more information, see Custom Data Types.

Shareable data types

Custom data types submitted to the platform by an app developer. Once approved, any app can read data of a shareable type, but only whitelisted apps as specified by the developer can write data of that shareable type.
For more information, see Shareable Data Types.

Public data types

Google Fit defines public data types for instantaneous readings and data types for aggregate data.

Data types for instantaneous readings

The following table lists data types for instantaneous readings:

Data Type Name Description Permission Fields (Format—Unit)
com.google.activity.sample Instantaneous sample of the current activity. Activity activity (int—enum)
confidence (float—percent)
com.google.activity.segment Continuous time interval of a single activity. Activity activity (int—enum)
(deprecated) com.google.calories.consumed Total calories consumed over a time interval. Activity calories (float—kcal)
com.google.calories.expended Total calories expended over a time interval. Activity calories (float—kcal)
com.google.cycling
.pedaling.cadence
Instantaneous pedaling rate in crank revolutions per minute. Activity rpm (float—rpm)
com.google.cycling
.wheel_revolution.rpm
Instantaneous wheel speed. Location rpm (float—rpm)
com.google.distance.delta Distance covered since the last reading. Location distance (float—meters)
com.google.heart_rate.bpm Heart rate in beats per minute. Body bpm (float—bpm)
com.google.height The user's height, in meters. Body height (float—meters)
com.google.location.sample The user's current location. Location latitude (float—degrees)
longitude (float—degrees)
accuracy (float—meters)
altitude (float—meters)
com.google.nutrition Food item information Nutrition nutrients (Map<String, float>—calories/grams/IU) meal_type (int—enum)
food_item (String—n/a)
com.google.power.sample Instantaneous power generated while performing an activity. Activity watts (float—watts)
com.google.speed Instantaneous speed over ground. Location speed (float—m/s)
com.google.step_count.cadence Instantaneous cadence in steps per minute. Activity rpm (float—steps/min)
com.google.step_count.delta Number of new steps since the last reading. Activity steps (int—count)
com.google.weight The user's weight. Body weight (float—kg)
com.google.activity.exercise A user's continuous workout routine. Activity exercise (int—enum)
repetitions (int—count)
resistance type (int—enum)
resistance (float—kg)
duration (int—milliseconds)

Data types for aggregate data

The following table lists data types for aggregate data:

Data Type Name Description Permission Fields (Format—Unit)
com.google.activity.summary Total time and number of segments in a particular activity for a time interval. Activity activity (int—enum)
duration (int—ms)
num_segments (int—count)
com.google.heart_rate.summary Average, maximum, and minimum beats per minute for a time interval. Body average (float—bpm)
max (float—bpm)
min (float—bpm)
com.google.location.bounding_box A bounding box for the user's location over a time interval. Location low_latitude (float—degrees)
low_longitude (float—degrees)
high_latitude (float—degrees)
high_longitude (float—degrees)
com.google.nutrition.summary User's nutrition intake during a time interval. Nutrition nutrients (Map<String, float>—calories/grams/IU)
meal_type (int—enum)
food_item (String—n/a)
com.google.power.summary Average, maximum, and minimum power generated while performing an activity. Activity average (float—watts)
max (float—watts)
min (float—watts)
com.google.speed.summary Average, maximum, and minimum speed over ground over a time interval. Location average (float—m/s)
max (float—m/s)
min (float—m/s)
com.google.weight.summary Average, maximum, and minimum weight over a time interval. Body average (float—kg)
max (float—kg)
min (float—kg)

Using data types with the REST API

The dataSources resource includes the data type (and a list of its fields) for each data source. You can specify one of these data types when you create data sources, and you can obtain the name of the data type and a list of its fields when you retrieve a data source from the fitness store.

For example, a data source representation specifies its data type as follows:

{
  "dataStreamId": "exampleDataSourceId",
  ...
  "dataType": {
    "field": [
      {
        "name": "steps",
        "format": "integer"
      }
    ],
    "name": "com.google.step_count.delta"
  },
  ...
}

When using one of the public data types in a data source, the data type name and its field definitions must match those listed in the tables above.

Custom data types

Google Fit enables you to create custom data types for your application and to use them to store fitness data. When you create custom data types, ensure that:

  • Google Fit does not already provide a similar data type.
  • The data type name is clear.
  • The data type name accurately represents the underlying data.
  • The prefix of the data type name matches the package name of your application.

Create a custom data type

To create a custom data type, create a new data source specifying the name of the data type and its field definitions.

For example, define a custom data type in a data source as follows:

{
  "dataStreamId": "exampleDataSourceId",
  ...
  "dataType": {
    "field": [
      {
        "name": "myFieldA",
        "format": "integer"
      },
      {
        "name": "myFieldB",
        "format": "integer"
      },
    ],
    "name": "com.example.myapp.mycustomtype"
  },
  ...
}

Use a custom data type

To insert fitness data of your custom type, specify the data source you created for your data type when you create a dataset with new data points. The data points must have the same number of components and types as those specified by your custom data type.

To read fitness data of your custom data type, specify the data source you created for your data type when you retrieve data points from the fitness store.

Shareable data types

Shareable data types are custom data types that have been approved by Google to be shared on Google Fit. You can submit a request to create a new shareable data type, and applications can use existing shareable data types in accordance with the terms and conditions set by the developer who created the data type.

Guidelines for new shareable data types

In addition to the guidelines for custom data types, ensure that your proposed shareable data type:

  • Does not duplicate an existing public data type.
  • Uses standard units when possible.
  • Represents fitness-related data.
  • Represents data that is relevant to other fitness apps.

Request a new shareable data type

To request a new shareable data type:

  1. Send an email to google-fit-shareable@google.com with a request to add a new shareable data type to Google Fit. Provide a brief description of your data type and explain why this data type might be useful to users and developers.

  2. If your proposed data type adheres to the Google Fit developer terms, follows the guidelines above, and has a compelling developer use case, we will send you a form to fill out.

  3. After you receive the form, provide the following data:

    Form Item Description
    Data type name

    Your data type name should accurately represent the underlying data. For example, one of the Google data types is com.google.location.sample, which represents a latitude-longitude location sample.

    The prefix of your data type name should not be tied to your application's package name, so developers can read this data type even if your application is not installed on the device.

    Use lowercase words to name your data type.

    Example of a good name: com.mycompanyname.mydatatypename

    Data type description

    Explain the following:

    • What the data type is
    • Roughly how it is calculated
    • Which of your devices and/or apps can provide data of this type
    • How can users and developers use data of this type
    Data type fields

    Provide the following:

    • Field names
    • Field types (only int and float are currently supported)
    • Field units (degrees, beats per minute, calories, and so on)

    For example, com.google.location.sample has these fields:

    • latitude (float – degrees)
    • longitude (float – degrees)
    Whitelisted accounts A list of Google Accounts to whitelist for access to these data types during development and testing.
    Apps that can write data A list of app package names that can write data of this type.

  4. Once we review your responses, you may get questions from our team before approval.

    For a shareable developer data type to be approved, the data type must:

    • Follow the guidelines listed above.
    • Be consistent with Google policies.
    • Have its format reviewed and approved by the Google Fit engineering team to ensure good design. The data type:
      • should not be ambiguous
      • should use standard units as much as possible
      • should include only fitness-related data
      • shouldn't be too broad (as close to raw data as possible)
    • Have its usefulness reviewed by the Google Fit product team. The data type:
      • should not be too specific or only enable one-to-one interactions
      • must enable making data accessible and useful by any app

  5. Your approved shareable data type will be launched within a mutually-agreed timeframe, and it will be listed in the Available Shareable Data Types section.

Available shareable data types

For more information about these shareable data types, see the third party developer terms and documentation for each data type.

Data Type Name Third Party Description Permission Fields
(Format—Unit)
Third Party Documentation
com.nike.NIKEFUEL Nike NikeFuel is a universal metric for movement that allows athletes to measure and compare all day activity and training intensity, and get real time feedback for any sport, at any skill level. Activity NIKEFUEL
(int—NikeFuel points)
Terms of Use
com.adidas.jump.height Adidas Jump height measures the height in inches for each jump recorded over a given period of time. Activity height
(float—inches)
Terms of Use
com.adidas.hustle Adidas Hustle measures how much force (effort) one generates through events (sprints, cuts and jumps) over a given period of time. Activity hustle
(float—m/s2/min)
Terms of Use
com.adidas.quickness Adidas Quickness is determined by how quick (on average) one changes their upper body linear speed or direction. Activity quickness
(float—m/s2/sec)
Terms of Use

Inserting data of a shareable type

Only applications approved by the developer of a shareable data type can write data of this type.

To insert data of a shareable type using the REST API, create a data source that specifies the shareable data type (including its fields and types) as the datasource's data type. Then use that data source to insert fitness data.

Reading data of a shareable type

To read data of a shareable type, look for available data sources whose data type is the shareable data type you're interested in.

发送以下问题的反馈:

此网页
Google Fit
Google Fit