Module: Toybox.Activity

Overview

The Activity module provides a way to retrieve available info for the current activity.

Activity Info is automatically provided by the compute() method in Data Fields. The getActivityInfo() method is available for use within apps or in other cases, such as data field initialization.

This module also provides two sets of constants:

  • SWIM_STROKE: Indicates the swimStrokeType(), such as freestyle, backstroke, or butterfly.

  • TIMER_STATE: Indicates the activity recording timerState(), such as stopped, started, paused, etc.

Since:

API Level 1.0.0

Classes Under Namespace

Classes: Info, ProfileInfo, WorkoutIntervalStep, WorkoutStep, WorkoutStepInfo

Constant Summary

SwimStrokeType

Name Value Since Description
SWIM_STROKE_FREESTYLE 0

API Level 1.2.2

Freestyle stroke

SWIM_STROKE_BACKSTROKE 1

API Level 1.2.2

Backstroke

SWIM_STROKE_BREASTSTROKE 2

API Level 1.2.2

Breaststroke

SWIM_STROKE_BUTTERFLY 3

API Level 1.2.2

Butterfly stroke

SWIM_STROKE_DRILL 4

API Level 1.2.2

Drill mode

SWIM_STROKE_MIXED 5

API Level 1.2.2

Mixed stroke mode

SWIM_STROKE_IM 6

API Level 1.2.2

Mixed interval with equal number of butterfly, backstroke, breaststroke, and freestyle, in that order.

TimerState

Name Value Since Description
TIMER_STATE_OFF 0

API Level 2.1.0

The timer is off. There is not an active recording

TIMER_STATE_STOPPED 1

API Level 2.1.0

The timer is stopped. The recording is active, with the timer stopped.

TIMER_STATE_PAUSED 2

API Level 2.1.0

The timer is paused. The recording is active with the timer paused. This state occurs when the timer is active, but has been stopped with the Auto-Pause feature.

TIMER_STATE_ON 3

API Level 2.1.0

The timer is on. The recording is active and the timer is running.

Sport

Since:

API Level 3.2.0

Name Value Since Description
SPORT_GENERIC 0
SPORT_RUNNING 1
SPORT_CYCLING 2
SPORT_TRANSITION 3
SPORT_FITNESS_EQUIPMENT 4
SPORT_SWIMMING 5
SPORT_BASKETBALL 6
SPORT_SOCCER 7
SPORT_TENNIS 8
SPORT_AMERICAN_FOOTBALL 9
SPORT_TRAINING 10
SPORT_WALKING 11
SPORT_CROSS_COUNTRY_SKIING 12
SPORT_ALPINE_SKIING 13
SPORT_SNOWBOARDING 14
SPORT_ROWING 15
SPORT_MOUNTAINEERING 16
SPORT_HIKING 17
SPORT_MULTISPORT 18
SPORT_PADDLING 19
SPORT_FLYING 20
SPORT_E_BIKING 21
SPORT_MOTORCYCLING 22
SPORT_BOATING 23
SPORT_DRIVING 24
SPORT_GOLF 25
SPORT_HANG_GLIDING 26
SPORT_HORSEBACK_RIDING 27
SPORT_HUNTING 28
SPORT_FISHING 29
SPORT_INLINE_SKATING 30
SPORT_ROCK_CLIMBING 31
SPORT_SAILING 32
SPORT_ICE_SKATING 33
SPORT_SKY_DIVING 34
SPORT_SNOWSHOEING 35
SPORT_SNOWMOBILING 36
SPORT_STAND_UP_PADDLEBOARDING 37
SPORT_SURFING 38
SPORT_WAKEBOARDING 39
SPORT_WATER_SKIING 40
SPORT_KAYAKING 41
SPORT_RAFTING 42
SPORT_WINDSURFING 43
SPORT_KITESURFING 44
SPORT_TACTICAL 45
SPORT_JUMPMASTER 46
SPORT_BOXING 47
SPORT_FLOOR_CLIMBING 48
SPORT_BASEBALL 49
SPORT_SOFTBALL_FAST_PITCH 50
SPORT_SOFTBALL_SLOW_PITCH 51
SPORT_SHOOTING 56
SPORT_AUTO_RACING 57
SPORT_INVALID 255

SubSport

Since:

API Level 3.2.0

Name Value Since Description
SUB_SPORT_GENERIC 0
SUB_SPORT_TREADMILL 1
SUB_SPORT_STREET 2
SUB_SPORT_TRAIL 3
SUB_SPORT_TRACK 4
SUB_SPORT_SPIN 5
SUB_SPORT_INDOOR_CYCLING 6
SUB_SPORT_ROAD 7
SUB_SPORT_MOUNTAIN 8
SUB_SPORT_DOWNHILL 9
SUB_SPORT_RECUMBENT 10
SUB_SPORT_CYCLOCROSS 11
SUB_SPORT_HAND_CYCLING 12
SUB_SPORT_TRACK_CYCLING 13
SUB_SPORT_INDOOR_ROWING 14
SUB_SPORT_ELLIPTICAL 15
SUB_SPORT_STAIR_CLIMBING 16
SUB_SPORT_LAP_SWIMMING 17
SUB_SPORT_OPEN_WATER 18
SUB_SPORT_FLEXIBILITY_TRAINING 19
SUB_SPORT_STRENGTH_TRAINING 20
SUB_SPORT_WARM_UP 21
SUB_SPORT_MATCH 22
SUB_SPORT_EXERCISE 23
SUB_SPORT_CHALLENGE 24
SUB_SPORT_INDOOR_SKIING 25
SUB_SPORT_CARDIO_TRAINING 26
SUB_SPORT_INVALID 255

WorkoutIntensity

Since:

API Level 3.2.0

Name Value Since Description
WORKOUT_INTENSITY_ACTIVE 0
WORKOUT_INTENSITY_REST 1
WORKOUT_INTENSITY_WARMUP 2
WORKOUT_INTENSITY_COOLDOWN 3
WORKOUT_INTENSITY_RECOVERY 4
WORKOUT_INTENSITY_INTERVAL 5
WORKOUT_INTENSITY_INVALID 255

WorkoutStepDurationType

Since:

API Level 3.2.0

Name Value Since Description
WORKOUT_STEP_DURATION_TIME 0
WORKOUT_STEP_DURATION_DISTANCE 1
WORKOUT_STEP_DURATION_HR_LESS_THAN 2
WORKOUT_STEP_DURATION_HR_GREATER_THAN 3
WORKOUT_STEP_DURATION_CALORIES 4
WORKOUT_STEP_DURATION_OPEN 5
WORKOUT_STEP_DURATION_REPEAT_UNTIL_STEPS_COMPLETE 6
WORKOUT_STEP_DURATION_REPEAT_UNTIL_TIME 7
WORKOUT_STEP_DURATION_REPEAT_UNTIL_DISTANCE 8
WORKOUT_STEP_DURATION_REPEAT_UNTIL_CALORIES 9
WORKOUT_STEP_DURATION_REPEAT_UNTIL_HR_LESS_THAN 10
WORKOUT_STEP_DURATION_REPEAT_UNTIL_HR_GREATER_THAN 11
WORKOUT_STEP_DURATION_REPEAT_UNTIL_POWER_LESS_THAN 12
WORKOUT_STEP_DURATION_REPEAT_UNTIL_POWER_GREATER_THAN 13
WORKOUT_STEP_DURATION_POWER_LESS_THAN 14
WORKOUT_STEP_DURATION_POWER_GREATER_THAN 15
WORKOUT_STEP_DURATION_TRAINING_PEAKS_TRAINING_STRESS_SCORE 16
WORKOUT_STEP_DURATION_REPEAT_UNTIL_POWER_LAST_LAP_LESS_THAN 17
WORKOUT_STEP_DURATION_REPEAT_UNTIL_MAX_POWER_LAST_LAP_LESS_THAN 18
WORKOUT_STEP_DURATION_POWER_3S_LESS_THAN 19
WORKOUT_STEP_DURATION_POWER_10S_LESS_THAN 20
WORKOUT_STEP_DURATION_POWER_30S_LESS_THAN 21
WORKOUT_STEP_DURATION_POWER_3S_GREATER_THAN 22
WORKOUT_STEP_DURATION_POWER_10S_GREATER_THAN 23
WORKOUT_STEP_DURATION_POWER_30S_GREATER_THAN 24
WORKOUT_STEP_DURATION_POWER_LAP_LESS_THAN 25
WORKOUT_STEP_DURATION_POWER_LAP_GREATER_THAN 26
WORKOUT_STEP_DURATION_REPEAT_UNTIL_TRAINING_PEAKS_TRAINING_STRESS_SCORE 27
WORKOUT_STEP_DURATION_REPETITION_TIME 28
WORKOUT_STEP_DURATION_REPS 29
WORKOUT_STEP_DURATION_INVALID 255

WorkoutStepTargetType

Since:

API Level 3.2.0

Name Value Since Description
WORKOUT_STEP_TARGET_SPEED 0
WORKOUT_STEP_TARGET_HEART_RATE 1
WORKOUT_STEP_TARGET_OPEN 2
WORKOUT_STEP_TARGET_CADENCE 3
WORKOUT_STEP_TARGET_POWER 4
WORKOUT_STEP_TARGET_GRADE 5
WORKOUT_STEP_TARGET_RESISTANCE 6
WORKOUT_STEP_TARGET_POWER_3S 7
WORKOUT_STEP_TARGET_POWER_10S 8
WORKOUT_STEP_TARGET_POWER_30S 9
WORKOUT_STEP_TARGET_POWER_LAP 10
WORKOUT_STEP_TARGET_SWIM_STROKE 11
WORKOUT_STEP_TARGET_SPEED_LAP 12
WORKOUT_STEP_TARGET_HEART_RATE_LAP 13
WORKOUT_STEP_TARGET_INHALE_DURATION 14
WORKOUT_STEP_TARGET_INHALE_HOLD_DURATION 15
WORKOUT_STEP_TARGET_EXHALE_DURATION 16
WORKOUT_STEP_TARGET_EXHALE_HOLD_DURATION 17
WORKOUT_STEP_TARGET_POWER_CURVE 18
WORKOUT_STEP_TARGET_INVALID 255

Instance Method Summary collapse

Instance Method Details

getActivityInfo() as Activity.Info or Null

Get the current Activity Info.

Returns:

  • Activity.Info

    The current Activity Info or null if there is no current activity.

Since:

API Level 1.0.0

getCurrentWorkoutStep() as Activity.WorkoutStepInfo or Null

Get information about the current workout step.

Supported Devices:

Returns:

Since:

API Level 3.2.0

Throws:

getNextWorkoutStep() as Activity.WorkoutStepInfo or Null

Get information about the next workout step.

Supported Devices:

Returns:

Since:

API Level 3.2.0

Throws:

getProfileInfo() as Activity.ProfileInfo

Get information about the current profile.

Returns:

Since:

API Level 3.2.0


Generated Nov 29, 2021 1:34:34 PM