Skip to content
Dashboard

Installation

Detour provides an Android SDK (com.swmansion.detour:detour-sdk) for deferred deep links, App Links, and custom scheme links.

A Detour app in the Dashboard is required before the SDK can resolve links. See Getting Started.

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

The SDK calls the Detour API over the network, so it needs the two standard Android network permissions, INTERNET and ACCESS_NETWORK_STATE. It declares both in its own manifest and manifest merging adds them to your app, so there is nothing to add to your AndroidManifest.xml.

dependencies {
implementation("com.swmansion.detour:detour-sdk:1.1.0")
}

Both values come from API configuration in the Dashboard: the appId and the publishable apiKey. See Getting Started.

Store credentials outside source control and pass them through BuildConfig, the way the SDK examples do:

app/build.gradle.kts
buildConfigField("String", "DETOUR_API_KEY", "\"${secrets["DETOUR_API_KEY"] ?: ""}\"")
buildConfigField("String", "DETOUR_APP_ID", "\"${secrets["DETOUR_APP_ID"] ?: ""}\"")
// Activity/Application code
val config = DetourConfig(
apiKey = BuildConfig.DETOUR_API_KEY,
appId = BuildConfig.DETOUR_APP_ID
)

Call Detour.initialize(...) once, before any link is processed.

Detour.initialize(applicationContext, config)

Application.onCreate() is the usual place. The first activity works too, as long as it runs before processLink() or getDeferredLink().

Android only dispatches a link to your app if a VIEW intent filter claims it. Add the filters to the activity that passes incoming intents to Detour.

Copy the generated filter from App configuration in the Dashboard. It has this structure:

AndroidManifest.xml
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="<your-host>" />
<data android:pathPrefix="/<app-hash>" />
<!-- The Dashboard adds any required legacy short-link prefixes. -->
</intent-filter>
</activity>

Keep the generated values rather than copying the placeholders above. New short links reuse /<app-hash> and do not require another manifest entry or native build.

If your app is served from a custom domain, the Dashboard generates the filter for that domain. Assign the domain before you copy the values. Changing the host an app is assigned to later needs a new build. Do not add hosts it did not generate: on Android 11 and lower that breaks App Link verification for every host at once, see Verification.

The Dashboard does not generate custom-scheme registration. If your app uses links such as myapp://product/42, add a separate filter to the same activity:

AndroidManifest.xml
<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="myapp" />
</intent-filter>

The example app shows the completed manifest and activity integration.

  1. Wire DetourDelegate or manual processing in Usage.
  2. Pick the closest runnable pattern in Examples.