Android SDK
lander-android receives, resolves and creates Lander links in native Android apps written in Kotlin or Java, and reports conversions.
Start a trial before using the SDK
SDK calls require an active trial or subscription. If billing is inactive, the API returns
402 subscription_required. Open your workspace's Billing page to start a trial or restore
access. Existing short links continue redirecting.
lander-android is the native Android SDK for Lander. It catches every link that opens your app (App Links and custom scheme URLs), asks Lander what the link means, and hands your app one tidy LanderLink with the route to open and the data you attached to it.
class App : Application() {
override fun onCreate() {
super.onCreate()
Lander.initialize(this, apiKey = "pk_live_...", enableLogging = BuildConfig.DEBUG)
}
}class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Lander.handleIntent(intent)
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
Lander.deepLinks.collect { link -> navigate(link.route) }
}
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
Lander.handleIntent(intent)
}
}That is the whole integration for most apps. The rest of this section explains each piece. Building with Flutter instead? Use the Flutter SDK.
What you get
- One
Flowfor every link. Cold start, warm start and deferred links (after an install) all arrive onLander.deepLinks. - Nothing lost at startup. Links that arrive before anything collects are buffered and replayed in order, so you can start collecting whenever your navigation is ready.
- No double navigation. The link that launched the app is delivered exactly once, whether you read it from the flow or from
Lander.getInitialLink(). A rotated or recreated activity does not deliver its link again. - Honest attribution. Every link says how sure Lander is:
DETERMINISTIC,PROBABILISTICorUNATTRIBUTED. - Unknown links still arrive. A URL Lander does not know (or cannot reach because the device is offline) still reaches your app with its raw URL.
- Short links from the app.
Lander.createLinkmakes a shareable link for invite and share flows. - Conversions that survive offline.
Lander.trackEventwrites to an on device queue and sends in batches with retries and deduplication. - Privacy first. A random install ID, no fingerprinting, no advertising ID.
- Small. It depends on kotlinx-coroutines and the Play Install Referrer library only, and talks HTTP with
HttpURLConnection. - Kotlin and Java. Suspending functions and a
Flowfor Kotlin, static methods with main thread callbacks for Java.
The public API at a glance
| Member | What it does |
|---|---|
Lander.initialize(context, apiKey, ...) | Starts the SDK. Call once, in Application.onCreate. |
Lander.handleIntent(intent) | Hands an intent to Lander. Call from onCreate and onNewIntent. |
Lander.deepLinks | Flow<LanderLink> of every link the app receives. |
Lander.addDeepLinkListener(listener) | The same links through a callback, for Java. |
Lander.getInitialLink() | The link that launched the app (or a deferred link), once. |
Lander.claimHandoff(userId) | After sign in, returns a link your backend handed off to that user. |
Lander.createLink(...) | Creates a short link, returns a LanderShortLink. |
Lander.trackEvent(name, ...) | Records a custom conversion event. |
Lander.installId | The random ID of this install. |
Full signatures are in the API reference.
How a tap becomes a screen
- Someone taps
https://acme.golander.link/p-123. - Android sees that your app has claimed the domain (Lander hosts the
assetlinks.jsonfile for you) and opens your activity instead of the browser. - Your activity passes its intent to
Lander.handleIntent. - The SDK calls
POST /v1/sdk/resolveonapi.golander.link. Lander records the open and answers with the link's route (/product/123), params and attribution labels. Lander.deepLinksemits aLanderLink, and your app openslink.route.
If the app was not installed, Lander sends the person to the Play Store with a single use token, and gives the link back on first launch. See Deferred links.
Requirements
| Minimum | |
|---|---|
| Android | API 24 (Android 7.0), minSdk 24 |
| Kotlin (if you use it) | 2.1 |
| Java | 17 bytecode |
The current SDK version is 0.1.0.