Skip to content

Quickstart

This guide covers running the Android sample app and validating a complete WorkoutKit launch flow.

This sample flow is meant to validate integration and launch behavior. In production, use your own GraphQL client, authorization logic, and app architecture. The sample app is intended as a reference implementation.

1. Open the sample app

Clone the Android SDK repository and open the sample app in Android Studio:

2. Configure GraphQL authentication in local.properties

In the SDK project, open or create local.properties to add your server values:

properties
GraphQLServerUrl=https://server.com/graphql
GraphQLAuthKey=your_auth_key_here

Never commit this file.

3. Install Apollo GraphQL plugin

In Android Studio, navigate to File -> Settings -> Plugins and install the Apollo GraphQL plugin from the marketplace.

4. Download schema

Use Tools -> Apollo -> Download Schema.

If the plugin flow fails, use the CLI fallback:

bash
./gradlew downloadServiceApolloSchemaFromIntrospection

5. Prepare launch data at runtime

Before creating a fragment, fetch workout session content from GraphQL and retrieve a valid JWT token from your backend.

6. Build fragment configuration

kotlin
val workoutConfig = JSONObject().apply {
    put("isHumanAudioCoachAvailable", false)
    put(
        "texts",
        JSONObject(
            mapOf(
                "startWorkoutCTA" to "Let's go!",
                "endedWorkoutTitle" to "Well done!",
                "saveWorkoutCTA" to "Close"
            )
        )
    )
}

7. Create and launch the right fragment

Classic workout:

kotlin
val goFragment = GoFragment.newInstance(
    workoutContent,
    workoutConfig,
    jwtToken
)

Video workout:

kotlin
val videoFragment = WorkoutVideoFragment.newInstance(
    workoutContent,
    workoutConfig,
    jwtToken
)

In your sample flow, choose GoFragment for classic sessions or WorkoutVideoFragment for video sessions, then attach the selected fragment to your activity container.

References