> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> How to install and set up the Stytch Consumer SDK in your Android application.

<Note>This guide is for our new Kotlin Multiplatform SDK which is in **Public beta**. If you are instead looking for the stable version, please see [stytch-android](https://github.com/stytchauth/stytch-android) and the usage docs [here](https://stytchauth.github.io/stytch-android/).</Note>

For a full walk-through of how to get up and running with a sign-up and login flow using Stytch, check out our [Quickstart Guide](/get-started/quickstart).

<Steps>
  <Step title="Add the dependency">
    Add the Stytch Consumer SDK to your `build.gradle.kts`:

    ```kotlin theme={null}
    dependencies {
        implementation("com.stytch.sdk:consumer-headless:VERSION")
    }
    ```

    The SDK is published to Maven Central. Make sure `mavenCentral()` is in your repository list.
  </Step>

  <Step title="Configure deep link handling">
    To handle magic links, register a custom URL scheme in your `AndroidManifest.xml`:

    ```xml theme={null}
    <activity android:name=".MainActivity" ...>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="your-app-scheme" />
        </intent-filter>
    </activity>
    ```

    Pass this scheme as the `loginRedirectUrl` and `signupRedirectUrl` when starting magic link flows.
  </Step>

  <Step title="Create the Stytch client">
    Initialize the Stytch client with your Project's `public_token` from the [Project Overview](https://stytch.com/dashboard) of the Stytch Dashboard.

    ```kotlin theme={null}
    import com.stytch.sdk.consumer.createStytchConsumer
    import com.stytch.sdk.data.StytchClientConfiguration

    val configuration = StytchClientConfiguration(
        context = applicationContext,
        publicToken = "public-token-test-1234"
    )
    val stytch = createStytchConsumer(configuration)
    ```

    The client is a singleton — subsequent calls to `createStytchConsumer` with the same process return the same instance.
  </Step>

  <Step title="Observe authentication state">
    Subscribe to `authenticationStateFlow` to react to sign-in and sign-out events:

    ```kotlin theme={null}
    lifecycleScope.launch {
        stytch.authenticationStateFlow.collect { state ->
            // state is ConsumerAuthenticationState.Authenticated, Unauthenticated, or Loading
        }
    }
    ```
  </Step>
</Steps>
