# Installation

Detour provides an Android SDK (`com.swmansion:detour`) for deferred deep links, app links, and scheme links.

:::note[Beta]
Android SDK `1.0.1` is currently in beta. APIs and integration details may still change before stable release.
:::

Before installation, make sure your app is created in the Detour Dashboard and you have:

- `appId` from **API configuration**
- publishable `apiKey` from **API configuration**
- Android link integration snippet from **App configuration**

## Requirements

- Android min SDK: `21` (Android 5.0+)
- Kotlin: `2.0+`
- JVM target: `11`

## Add dependency

```kotlin
    dependencies {
      implementation("com.swmansion:detour:1.0.1")
    }
    ```
  ```groovy
    dependencies {
      implementation "com.swmansion:detour:1.0.1"
    }
    ```
  ## Configure credentials

Store credentials in config/environment and pass them through `BuildConfig` (same pattern as SDK examples):

```kotlin
// app/build.gradle.kts
buildConfigField("String", "DETOUR_API_KEY", "\"${secrets["DETOUR_API_KEY"] ?: ""}\"")
buildConfigField("String", "DETOUR_APP_ID", "\"${secrets["DETOUR_APP_ID"] ?: ""}\"")
```

```kotlin
// Activity/Application code
val config = DetourConfig(
    apiKey = BuildConfig.DETOUR_API_KEY,
    appId = BuildConfig.DETOUR_APP_ID
)
```

## Initialize SDK once

Call `Detour.initialize(...)` once before processing links.

```kotlin
Detour.initialize(applicationContext, config)
```

You can initialize in `Application.onCreate()` or in the first activity before calling `processLink()` / `getDeferredLink()`.

## Manifest integration

Add `VIEW` intent filters for links you want Android to dispatch to your app:

- verified App Links (`https://...`) from Dashboard snippet
- optional custom URI scheme (`myapp://...`)

Example SDK apps use this pattern in `AndroidManifest.xml` and handle both app links and scheme links in one flow.

## Next steps

1. Wire `DetourDelegate` or manual processing in [Usage](https://detour.swmansion.com/docs/sdk/android/sdk-usage).
2. Pick the closest runnable pattern in [Examples](https://detour.swmansion.com/docs/sdk/android/examples).