FitnessActivities

public class FitnessActivities extends Object

Constants representing different user activities, such as walking, running, and cycling. Activities are used in Sessions, DataTypes and in read queries.

A Session associates an activity with all data that was recorded during a time interval, such as heart rate samples taken while the user was doing aerobics, or wheel RPM measured while biking.

Activities be stored and read using the activity segment data types. When samples are stored, these are automatically converted into segments by the platform's default data source.

When reading data, the activity segment and activity type bucketing strategies can be used to aggregate data by the activities happening at the time data was collected. This would allow, for instance, aggregating step counts taken during running and those taken during walking separately, or to query the average heart rate during each activity.

Each activity is represented by its name, which is a string constant. These constants are also used in intents for tracking and visualizing activity data. Internally, activities are stored as integers inside of DataPoint for efficiency. You can convert between the String and int representations for storage using DataPoint.Builder.setActivityField(com.google.android.gms.fitness.data.Field, String) and Value.asActivity().

Constant Summary

String AEROBICS The user is performing aerobic exercises.
String ARCHERY The user is doing archery, using a bow to shoot an arrow.
String BADMINTON The user is playing badminton.
String BASEBALL The user is playing baseball.
String BASKETBALL The user is playing basketball.
String BIATHLON The user is practicing biathlon (combination of cross-country skiing and rifle shooting).
String BIKING The user is on a bicycle.
String BIKING_HAND The user is handcycling (or handbiking).
String BIKING_MOUNTAIN The user is mountain biking.
String BIKING_ROAD The user is cycling on a road or other smooth surface.
String BIKING_SPINNING The user is indoor cycling (spinning) on a specialized stationary bike.
String BIKING_STATIONARY The user is cycling on a stationary bike.
String BIKING_UTILITY The user is cycling as a means of transport.
String BOXING The user is boxing.
String CALISTHENICS The user is performing calisthenics exercises.
String CIRCUIT_TRAINING The user is performing circuit training exercises.
String CRICKET The user is playing cricket.
String CROSSFIT The user is performing Crossfit exercises.
String CURLING The user is practicing curling.
String DANCING The user is dancing.
String DIVING The user is diving into water, from a platform or spring board.
String ELEVATOR The user is taking an elevator.
String ELLIPTICAL The user is using an elliptical trainer or cross-trainer machine.
String ERGOMETER The user is using an ergometer machine.
String ESCALATOR The user is taking an escalator.
String EXTRA_STATUS Name for the String extra containing the status of an activity.
String FENCING The user is fencing.
String FOOTBALL_AMERICAN The user is playing American football (known as football in the United States).
String FOOTBALL_AUSTRALIAN The user is playing Australian-rules football.
String FOOTBALL_SOCCER The user is playing association football (known as soccer in the United States).
String FRISBEE_DISC The user is playing with a Frisbee disc.
String GARDENING The user is gardening.
String GOLF The user is playing golf.
String GUIDED_BREATHING The user is engaging in guided breathing.
String GYMNASTICS The user is practicing gymnastics.
String HANDBALL The user is playing handball.
String HIGH_INTENSITY_INTERVAL_TRAINING The user is performing high intensity interval training (HIIT).
String HIKING The user is hiking.
String HOCKEY The user is playing hockey.
String HORSEBACK_RIDING The user is horseback riding.
String HOUSEWORK The user is doing house work.
String ICE_SKATING The user is ice-skating.
String INTERVAL_TRAINING The user is performing interval training.
String IN_VEHICLE The user is in a vehicle, such as a car.
String JUMP_ROPE The user is jumping rope.
String KAYAKING The user is kayaking.
String KETTLEBELL_TRAINING The user is training with a kettlebell.
String KICKBOXING The user is kickboxing.
String KICK_SCOOTER The user is riding a kick scooter.
String KITESURFING The user is kite-surfing.
String MARTIAL_ARTS The user is practicing martial arts.
String MEDITATION The user is meditating.
String MIME_TYPE_PREFIX The common prefix for activity MIME types.
String MIXED_MARTIAL_ARTS The user is practicing mixed martial arts (MMA).
String ON_FOOT This constant is deprecated. Use the more specific activity (for example RUNNING, WALKING, or RUNNING_JOGGING).
String OTHER The user is performing a generic fitness activity, which isn't classified.
String P90X The user is performing P90X exercises.
String PARAGLIDING The user is paragliding.
String PILATES The user is performing pilates exercises.
String POLO The user is playing polo (team sport on horseback).
String RACQUETBALL The user is playing racquetball.
String ROCK_CLIMBING The user is rock climbing.
String ROWING The user is rowing.
String ROWING_MACHINE The user is using a rowing machine.
String RUGBY The user is playing rugby.
String RUNNING The user is running.
String RUNNING_JOGGING The user is jogging.
String RUNNING_SAND The user is running on sand.
String RUNNING_TREADMILL The user is running on a treadmill.
String SAILING The user is sailing.
String SCUBA_DIVING The user is scuba diving.
String SKATEBOARDING The user is skateboarding.
String SKATING The user is skating.
String SKATING_CROSS The user is cross skating.
String SKATING_INDOOR The user is skating in-doors.
String SKATING_INLINE The user is inline skating (roller-blading).
String SKIING The user is skiing.
String SKIING_BACK_COUNTRY The user is back-country skiing.
String SKIING_CROSS_COUNTRY The user is cross-country skiing.
String SKIING_DOWNHILL The user is downhill skiing.
String SKIING_KITE The user is kite skiing.
String SKIING_ROLLER The user is roller skiing (non-snow).
String SLEDDING The user is sledding.
String SLEEP The user is sleeping.
String SLEEP_AWAKE This constant is deprecated. No longer valid activity for Sessions or activity segment. See SleepStages.AWAKE and DataType.TYPE_SLEEP_SEGMENT
String SLEEP_DEEP This constant is deprecated. No longer valid activity for Sessions or activity segment. SleepStages.SLEEP_DEEP and DataType.TYPE_SLEEP_SEGMENT
String SLEEP_LIGHT This constant is deprecated. No longer valid activity for Sessions or activity segments. See SleepStages.SLEEP_LIGHT and DataType.TYPE_SLEEP_SEGMENT
String SLEEP_REM This constant is deprecated. No longer valid activity for Sessions or activity segment. See SleepStages.SLEEP_REM and DataType.TYPE_SLEEP_SEGMENT
String SNOWBOARDING The user is snowboarding.
String SNOWMOBILE The user is on a snow mobile.
String SNOWSHOEING The user is snow-shoeing.
String SOFTBALL The user is playing softball.
String SQUASH The user is playing Squash.
String STAIR_CLIMBING The user is climbing stairs.
String STAIR_CLIMBING_MACHINE The user is using a stair-climbing machine.
String STANDUP_PADDLEBOARDING The user is on a stand-up paddle board.
String STATUS_ACTIVE Status indicating the activity has started.
String STATUS_COMPLETED Status indicating the activity has ended.
String STILL The user is still (not moving).
String STRENGTH_TRAINING The user is strength training.
String SURFING The user is surfing.
String SWIMMING The user is swimming.
String SWIMMING_OPEN_WATER The user is swimming in open waters.
String SWIMMING_POOL The user is swimming in a swimming pool.
String TABLE_TENNIS The user is playing table tennis (or ping-pong).
String TEAM_SPORTS The user is playing a team sport.
String TENNIS The user is playing tennis.
String TILTING This is a synthetic activity used to indicate that the device angle relative to gravity changed significantly between the sample immediately before and immediately after the "tilting" sample.
String TREADMILL This constant is deprecated. Use WALKING_TREADMILL or RUNNING_TREADMILL instead.
String UNKNOWN The current activity is not known.
String VOLLEYBALL The user is playing volleyball.
String VOLLEYBALL_BEACH The user is playing beach volleyball.
String VOLLEYBALL_INDOOR The user is playing indoor volleyball.
String WAKEBOARDING The user is wake boarding.
String WALKING The user is walking.
String WALKING_FITNESS The user is walking at a moderate to high pace, for fitness.
String WALKING_NORDIC The user is performing Nordic walking (with poles).
String WALKING_PACED The user is performing paced walking.
String WALKING_STROLLER The user is walking while pushing a stroller.
String WALKING_TREADMILL The user is walking on a treadmill
String WATER_POLO The user is playing water polo.
String WEIGHTLIFTING The user is weightlifting.
String WHEELCHAIR The user is on a wheel chair.
String WINDSURFING The user is wind surfing.
String YOGA The user is performing Yoga poses.
String ZUMBA The users is performing Zumba exercises.

Public Method Summary

static String
getMimeType(String activity)
Returns the MIME type for a particular activity.

Inherited Method Summary

Constants

public static final String AEROBICS

The user is performing aerobic exercises.

Constant Value: "aerobics"

public static final String ARCHERY

The user is doing archery, using a bow to shoot an arrow.

Constant Value: "archery"

public static final String BADMINTON

The user is playing badminton.

Constant Value: "badminton"

public static final String BASEBALL

The user is playing baseball.

Constant Value: "baseball"

public static final String BASKETBALL

The user is playing basketball.

Constant Value: "basketball"

public static final String BIATHLON

The user is practicing biathlon (combination of cross-country skiing and rifle shooting).

Constant Value: "biathlon"

public static final String BIKING

The user is on a bicycle.

Constant Value: "biking"

public static final String BIKING_HAND

The user is handcycling (or handbiking).

Constant Value: "biking.hand"

public static final String BIKING_MOUNTAIN

The user is mountain biking.

Constant Value: "biking.mountain"

public static final String BIKING_ROAD

The user is cycling on a road or other smooth surface.

Constant Value: "biking.road"

public static final String BIKING_SPINNING

The user is indoor cycling (spinning) on a specialized stationary bike.

Constant Value: "biking.spinning"

public static final String BIKING_STATIONARY

The user is cycling on a stationary bike.

Constant Value: "biking.stationary"

public static final String BIKING_UTILITY

The user is cycling as a means of transport.

Constant Value: "biking.utility"

public static final String BOXING

The user is boxing.

Constant Value: "boxing"

public static final String CALISTHENICS

The user is performing calisthenics exercises.

Constant Value: "calisthenics"

public static final String CIRCUIT_TRAINING

The user is performing circuit training exercises.

Constant Value: "circuit_training"

public static final String CRICKET

The user is playing cricket.

Constant Value: "cricket"

public static final String CROSSFIT

The user is performing Crossfit exercises.

Constant Value: "crossfit"

public static final String CURLING

The user is practicing curling.

Constant Value: "curling"

public static final String DANCING

The user is dancing.

Constant Value: "dancing"

public static final String DIVING

The user is diving into water, from a platform or spring board.

Constant Value: "diving"

public static final String ELEVATOR

The user is taking an elevator.

Constant Value: "elevator"

public static final String ELLIPTICAL

The user is using an elliptical trainer or cross-trainer machine.

Constant Value: "elliptical"

public static final String ERGOMETER

The user is using an ergometer machine.

Constant Value: "ergometer"

public static final String ESCALATOR

The user is taking an escalator.

Constant Value: "escalator"

public static final String EXTRA_STATUS

Name for the String extra containing the status of an activity. This is a mandatory extra for Fitness.ACTION_TRACK intents, and holds one of the following values:

Constant Value: "actionStatus"

public static final String FENCING

The user is fencing.

Constant Value: "fencing"

public static final String FOOTBALL_AMERICAN

The user is playing American football (known as football in the United States).

Constant Value: "football.american"

public static final String FOOTBALL_AUSTRALIAN

The user is playing Australian-rules football.

Constant Value: "football.australian"

public static final String FOOTBALL_SOCCER

The user is playing association football (known as soccer in the United States).

Constant Value: "football.soccer"

public static final String FRISBEE_DISC

The user is playing with a Frisbee disc.

Constant Value: "frisbee_disc"

public static final String GARDENING

The user is gardening.

Constant Value: "gardening"

public static final String GOLF

The user is playing golf.

Constant Value: "golf"

public static final String GUIDED_BREATHING

The user is engaging in guided breathing.

Constant Value: "guided_breathing"

public static final String GYMNASTICS

The user is practicing gymnastics.

Constant Value: "gymnastics"

public static final String HANDBALL

The user is playing handball.

Constant Value: "handball"

public static final String HIGH_INTENSITY_INTERVAL_TRAINING

The user is performing high intensity interval training (HIIT).

Constant Value: "interval_training.high_intensity"

public static final String HIKING

The user is hiking.

Constant Value: "hiking"

public static final String HOCKEY

The user is playing hockey.

Constant Value: "hockey"

public static final String HORSEBACK_RIDING

The user is horseback riding.

Constant Value: "horseback_riding"

public static final String HOUSEWORK

The user is doing house work.

Constant Value: "housework"

public static final String ICE_SKATING

The user is ice-skating.

Constant Value: "ice_skating"

public static final String INTERVAL_TRAINING

The user is performing interval training.

Constant Value: "interval_training"

public static final String IN_VEHICLE

The user is in a vehicle, such as a car.

Constant Value: "in_vehicle"

public static final String JUMP_ROPE

The user is jumping rope.

Constant Value: "jump_rope"

public static final String KAYAKING

The user is kayaking.

Constant Value: "kayaking"

public static final String KETTLEBELL_TRAINING

The user is training with a kettlebell.

Constant Value: "kettlebell_training"

public static final String KICKBOXING

The user is kickboxing.

Constant Value: "kickboxing"

public static final String KICK_SCOOTER

The user is riding a kick scooter.

Constant Value: "kick_scooter"

public static final String KITESURFING

The user is kite-surfing.

Constant Value: "kitesurfing"

public static final String MARTIAL_ARTS

The user is practicing martial arts.

Constant Value: "martial_arts"

public static final String MEDITATION

The user is meditating.

Constant Value: "meditation"

public static final String MIME_TYPE_PREFIX

The common prefix for activity MIME types. The MIME type for a particular activity type will be this prefix followed by the activity name. Examples:

 vnd.google.fitness.activity/walking
 vnd.google.fitness.activity/biking.mountain
 vnd.google.fitness.activity/jump_rope
 
The names for all activities are described by the constants in this class. The full MIME type can be computed using getMimeType(String)
Constant Value: "vnd.google.fitness.activity/"

public static final String MIXED_MARTIAL_ARTS

The user is practicing mixed martial arts (MMA).

Constant Value: "martial_arts.mixed"

public static final String ON_FOOT

This constant is deprecated.
Use the more specific activity (for example RUNNING, WALKING, or RUNNING_JOGGING).

The user is on foot, walking, or running.

Constant Value: "on_foot"

public static final String OTHER

The user is performing a generic fitness activity, which isn't classified.

Unlike unknown, which gives no indication as to what the user is doing, "other" indicates that the user is performing a fitness-related activity.

The "other" activity is most useful to collect user input, for instance when an app wants to give the user the ability to choose an activity that's not part of the regular activity set for the app.

Note that an activity classified as "other" could represent any of the other activities in this activity list, as well as an activity not in this list.

Constant Value: "other"

public static final String P90X

The user is performing P90X exercises.

Constant Value: "p90x"

public static final String PARAGLIDING

The user is paragliding.

Constant Value: "paragliding"

public static final String PILATES

The user is performing pilates exercises.

Constant Value: "pilates"

public static final String POLO

The user is playing polo (team sport on horseback).

Constant Value: "polo"

public static final String RACQUETBALL

The user is playing racquetball.

Constant Value: "racquetball"

public static final String ROCK_CLIMBING

The user is rock climbing.

Constant Value: "rock_climbing"

public static final String ROWING

The user is rowing.

Constant Value: "rowing"

public static final String ROWING_MACHINE

The user is using a rowing machine.

Constant Value: "rowing.machine"

public static final String RUGBY

The user is playing rugby.

Constant Value: "rugby"

public static final String RUNNING

The user is running.

Constant Value: "running"

public static final String RUNNING_JOGGING

The user is jogging.

Constant Value: "running.jogging"

public static final String RUNNING_SAND

The user is running on sand.

Constant Value: "running.sand"

public static final String RUNNING_TREADMILL

The user is running on a treadmill.

Constant Value: "running.treadmill"

public static final String SAILING

The user is sailing.

Constant Value: "sailing"

public static final String SCUBA_DIVING

The user is scuba diving.

Constant Value: "scuba_diving"

public static final String SKATEBOARDING

The user is skateboarding.

Constant Value: "skateboarding"

public static final String SKATING

The user is skating.

Constant Value: "skating"

public static final String SKATING_CROSS

The user is cross skating.

Constant Value: "skating.cross"

public static final String SKATING_INDOOR

The user is skating in-doors.

Constant Value: "skating.indoor"

public static final String SKATING_INLINE

The user is inline skating (roller-blading).

Constant Value: "skating.inline"

public static final String SKIING

The user is skiing.

Constant Value: "skiing"

public static final String SKIING_BACK_COUNTRY

The user is back-country skiing.

Constant Value: "skiing.back_country"

public static final String SKIING_CROSS_COUNTRY

The user is cross-country skiing.

Constant Value: "skiing.cross_country"

public static final String SKIING_DOWNHILL

The user is downhill skiing.

Constant Value: "skiing.downhill"

public static final String SKIING_KITE

The user is kite skiing.

Constant Value: "skiing.kite"

public static final String SKIING_ROLLER

The user is roller skiing (non-snow).

Constant Value: "skiing.roller"

public static final String SLEDDING

The user is sledding.

Constant Value: "sledding"

public static final String SLEEP

The user is sleeping.

Constant Value: "sleep"

public static final String SLEEP_AWAKE

This constant is deprecated.
No longer valid activity for Sessions or activity segment. See SleepStages.AWAKE and DataType.TYPE_SLEEP_SEGMENT

The user is in an awake period in the middle of a sleep session.

Constant Value: "sleep.awake"

public static final String SLEEP_DEEP

This constant is deprecated.
No longer valid activity for Sessions or activity segment. SleepStages.SLEEP_DEEP and DataType.TYPE_SLEEP_SEGMENT

The user is in a deep sleep cycle.

Constant Value: "sleep.deep"

public static final String SLEEP_LIGHT

This constant is deprecated.
No longer valid activity for Sessions or activity segments. See SleepStages.SLEEP_LIGHT and DataType.TYPE_SLEEP_SEGMENT

The user is in a light sleep cycle.

Constant Value: "sleep.light"

public static final String SLEEP_REM

This constant is deprecated.
No longer valid activity for Sessions or activity segment. See SleepStages.SLEEP_REM and DataType.TYPE_SLEEP_SEGMENT

The user is in a REM sleep cycle. *

Constant Value: "sleep.rem"

public static final String SNOWBOARDING

The user is snowboarding.

Constant Value: "snowboarding"

public static final String SNOWMOBILE

The user is on a snow mobile.

Constant Value: "snowmobile"

public static final String SNOWSHOEING

The user is snow-shoeing.

Constant Value: "snowshoeing"

public static final String SOFTBALL

The user is playing softball.

Constant Value: "softball"

public static final String SQUASH

The user is playing Squash.

Constant Value: "squash"

public static final String STAIR_CLIMBING

The user is climbing stairs.

Constant Value: "stair_climbing"

public static final String STAIR_CLIMBING_MACHINE

The user is using a stair-climbing machine.

Constant Value: "stair_climbing.machine"

public static final String STANDUP_PADDLEBOARDING

The user is on a stand-up paddle board.

Constant Value: "standup_paddleboarding"

public static final String STATUS_ACTIVE

Status indicating the activity has started.

Constant Value: "ActiveActionStatus"

public static final String STATUS_COMPLETED

Status indicating the activity has ended.

Constant Value: "CompletedActionStatus"

public static final String STILL

The user is still (not moving).

Constant Value: "still"

public static final String STRENGTH_TRAINING

The user is strength training.

Constant Value: "strength_training"

public static final String SURFING

The user is surfing.

Constant Value: "surfing"

public static final String SWIMMING

The user is swimming.

Constant Value: "swimming"

public static final String SWIMMING_OPEN_WATER

The user is swimming in open waters.

Constant Value: "swimming.open_water"

public static final String SWIMMING_POOL

The user is swimming in a swimming pool.

Constant Value: "swimming.pool"

public static final String TABLE_TENNIS

The user is playing table tennis (or ping-pong).

Constant Value: "table_tennis"

public static final String TEAM_SPORTS

The user is playing a team sport.

Constant Value: "team_sports"

public static final String TENNIS

The user is playing tennis.

Constant Value: "tennis"

public static final String TILTING

This is a synthetic activity used to indicate that the device angle relative to gravity changed significantly between the sample immediately before and immediately after the "tilting" sample. This often occurs when a device is picked up from a desk or when a user who is sitting stands up.

Constant Value: "tilting"

public static final String TREADMILL

This constant is deprecated.
Use WALKING_TREADMILL or RUNNING_TREADMILL instead.

The user is on a treadmill (either walking or running).

Constant Value: "treadmill"

public static final String UNKNOWN

The current activity is not known. In this case, the activity could be any of the activities described in this class, or a completely different one.

Constant Value: "unknown"

public static final String VOLLEYBALL

The user is playing volleyball.

Constant Value: "volleyball"

public static final String VOLLEYBALL_BEACH

The user is playing beach volleyball.

Constant Value: "volleyball.beach"

public static final String VOLLEYBALL_INDOOR

The user is playing indoor volleyball.

Constant Value: "volleyball.indoor"

public static final String WAKEBOARDING

The user is wake boarding.

Constant Value: "wakeboarding"

public static final String WALKING

The user is walking.

Constant Value: "walking"

public static final String WALKING_FITNESS

The user is walking at a moderate to high pace, for fitness.

Constant Value: "walking.fitness"

public static final String WALKING_NORDIC

The user is performing Nordic walking (with poles).

Constant Value: "walking.nordic"

public static final String WALKING_PACED

The user is performing paced walking.

Constant Value: "walking.paced"

public static final String WALKING_STROLLER

The user is walking while pushing a stroller.

Constant Value: "walking.stroller"

public static final String WALKING_TREADMILL

The user is walking on a treadmill

Constant Value: "walking.treadmill"

public static final String WATER_POLO

The user is playing water polo.

Constant Value: "water_polo"

public static final String WEIGHTLIFTING

The user is weightlifting.

Constant Value: "weightlifting"

public static final String WHEELCHAIR

The user is on a wheel chair.

Constant Value: "wheelchair"

public static final String WINDSURFING

The user is wind surfing.

Constant Value: "windsurfing"

public static final String YOGA

The user is performing Yoga poses.

Constant Value: "yoga"

public static final String ZUMBA

The users is performing Zumba exercises.

Constant Value: "zumba"

Public Methods

public static String getMimeType (String activity)

Returns the MIME type for a particular activity. The MIME type is used in intents for viewing a session and tracking an activity.

Parameters
activity The desired activity.