SDK / ANDROID
Deep linking for Android apps.
Use the Android SDK from a coroutine to resolve incoming App Link URIs, read Play Install Referrer tokens, and route with the returned payload.
01 / Install
Add the SDK
No published Maven coordinate is present in this repository. This setup includes the library module from a local SDK checkout.
// From your consuming app, point to the local SDK checkout.
include(":wilderlinks")
project(":wilderlinks").projectDir = file("../wilderlinks-sdks/android/wilderlinks")02 / Configure
Initialize once
Use the WilderLinks API base URL and add the exact link host configured for your app. Replace links.example.com with that host.
import android.app.Application
import com.wilderbots.wilderlinks.Wilderlinks
import com.wilderbots.wilderlinks.WilderlinksConfig
class App : Application() {
override fun onCreate() {
super.onCreate()
Wilderlinks.init(
WilderlinksConfig(
baseUrl = "https://api.wilderlinks.space",
domains = listOf("links.example.com")
)
)
}
}03 / Resolve
Handle an incoming link
The SDK returns a match result; your application remains responsible for navigating to the right screen.
import android.content.Context
import android.net.Uri
import com.wilderbots.wilderlinks.Wilderlinks
suspend fun handleIncomingLink(uri: Uri, context: Context) {
val result = Wilderlinks.handleIncomingUri(uri, context)
if (result.matched) {
val payload = result.deepLinkPayload
val destination = result.destinationUrl
}
}Fields returned by the primary link handler
matchedopenIddestinationUrldeepLinkPayloadinstallAttributionProvidererror04 / Deferred matching
Match only tokens your app can access
import android.content.Context
import com.wilderbots.wilderlinks.Wilderlinks
suspend fun checkFirstLaunch(context: Context) {
val result = Wilderlinks.checkInstallReferrer(context)
if (result.matched) {
val payload = result.deepLinkPayload
}
}- checkInstallReferrer(context) reads Google Play Install Referrer and matches a dl_match_token when available.
- checkDeferredInstall(context) separately checks clipboard fallback. It is not a substitute for Play Install Referrer.
- matchDeferredToken(baseUrl, token) and matchInstallAttributionToken(baseUrl, token, provider) exchange tokens already obtained by the app.
05 / Platform setup
Before testing on a device
- The repository currently provides an Android library module, not a published Maven coordinate. Include the module from your SDK checkout as shown; the SDK build declares Gradle 8.9, AGP 8.7.3, Kotlin Android 2.0.21, and JDK 21.
- In the consuming app module, add implementation(project(":wilderlinks")) to dependencies. If the app uses a custom Application class for initialization, register that class in the app manifest.
- The module declares INTERNET permission and minSdk 23. It does not add your app’s verified App Links intent filter or host association; configure those in the consuming app and domain.
- handleIncomingUri(...) and the deferred methods are suspend functions. Call them from an app-owned coroutine scope; the SDK does not choose your lifecycle scope.
06 / Security
Keep private credentials server-side
Do not ship organization or private API keys in mobile apps, browser JavaScript, or Unity client builds. Client-side link resolution and authenticated link-management operations have different trust boundaries; keep API-key operations in a trusted server environment.
To create a link in response to an action in your Android app, send the link details to an endpoint in your own backend using your app’s normal user authentication. That backend must verify the user is allowed to create the link, then call WilderLinks (for example, POST /api/v1/links) with the organization API key held only on the server.
- Your app sends the requested destination and link settings to your backend.
- Your backend authenticates and authorizes the user, then creates the WilderLinks link.
- Your backend returns the generated URL; the app shares or displays it using its platform-appropriate UI.
The native SDKs now expose createLink, createDeepLink, and createShortLink. They require an organization API key with links:write; configure that key only in a trusted runtime, never in a distributed app.
These SDKs do not provide your app’s authenticated link-creation backend endpoint; implement that endpoint in your own backend.
07 / Troubleshooting
When a link does not match
- An IllegalStateException indicates Wilderlinks.init(...) was not called first.
- Confirm uri.host exactly matches one of WilderlinksConfig.domains and that Android delivers the App Link to your activity.
- If install matching returns unmatched, verify the Play referrer contains dl_match_token and the app was installed through the Play testing track.
Continue building