Skip to content

Classic Workouts

Classic workouts are rendered through GoFragment.

Capabilities

  • Navigate through exercises
  • Display exercise details
  • Pause and resume flow
  • Voice coach guidance support

Create the fragment

kotlin
val goFragment = GoFragment.newInstance(
    workoutContent,   // GraphQL payload
    workoutConfig,    // JSON configuration
    jwtToken          // JWT token
)

Host activity integration

  • Add goFragment to your activity layout or container.
  • Manage lifecycles in your host activity as usual.
  • Configure texts/behavior through JSON keys before fragment creation.

Handle completion

Classic workouts report completion through the TrainingKitInterface implemented by your host activity.

kotlin
override fun saveWorkout(state: SaveWorkoutState) {
    // The workout completed. Persist state, then notify TrainingKit/save UI.
}

override fun closeGoMode(state: SaveWorkoutState?) {
    // The user closed the workout before completing it.
    finish()
}

override fun trackEvent(
    name: Tracking.Event,
    properties: Map<Tracking.Property, String>?
) {
    // Optional: forward TrainingKit analytics metadata.
}

Use saveWorkout as the source of truth for completed workout results. Use closeGoMode for exits that do not produce a completed save, and trackEvent for analytics-only events.