DBDelve
Dive deep into your data. A fast, native, multi-engine database client written in Rust. Free and open source, no telemetry.
翻訳待ち
No updates detected yet. GitHub releases will appear here.
Deep linking without the fuss: the Android SDK for Lander. Read only mirror of sdk/lander_android.
翻訳待ち
Loading the full README.
Read the full README ↗Deep linking without the fuss. The native Android SDK for Lander, in Kotlin: receive App Links and custom scheme URLs, resolve them to the link you created in Lander, recover deferred links after install, create short links from inside the app, and report conversions.
Flow for every link: cold start, warm start, deferred (after install).DETERMINISTIC, PROBABILISTIC or UNATTRIBUTED.HttpURLConnection.Requires Android API 24+ (minSdk 24). Works from Kotlin and Java. Full docs: docs.golander.link/docs/android.
// app/build.gradle.kts
dependencies {
implementation("link.golander:lander-android:0.1.0")
}
The SDK declares the INTERNET permission and brings com.android.installreferrer:installreferrer, so there is nothing else to add.
Inside the <activity> that should open links (usually your launcher activity), in AndroidManifest.xml:
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop">
<!-- App Links for your Lander domain. autoVerify makes Android check
https://<domain>/.well-known/assetlinks.json, which Lander serves. -->
<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" android:host="acme.golander.link" />
</intent-filter>
<!-- Optional: custom scheme -->
<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="acmeshop" />
</intent-filter>
</activity>
android:launchMode="singleTop" makes links that arrive while the app runs go to onNewIntent instead of starting a second activity.
In the Lander dashboard (Apps, Android), add your package name and the SHA-256 fingerprints of every signing key (debug, upload and the Play App Signing key) so assetlinks.json verifies. Check verification with:
adb shell pm get-app-links com.acme.shop
Call initialize once, in Application.onCreate. It returns immediately: loading the install ID, the launch report (POST /v1/sdk/init) and, on first launch, the Play Install Referrer all run in the background.
class App : Application() {
override fun onCreate() {
super.onCreate()
Lander.initialize(
this,
apiKey = "pk_live_...", // publishable key from the dashboard
enableLogging = BuildConfig.DEBUG,
)
}
}
Only publishable keys (pk_test_..., pk_live_...) are accepted. Secret keys (sk_...) are rejected, because anything shipped in an app is public. Surrounding whitespace is ignored. A bad key throws IllegalArgumentException, and the message never contains the key.
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)
}
}
Call handleIntent in both places, for every intent: an intent without a link tells Lander the app was not opened by one. The SDK marks each intent it read, so an activity recreated after a rotation or process death does not deliver its link again.
LanderLink mirrors the API's ResolvedLink:
| Field | Meaning |
|---|---|
uri, uriString | The URL that opened the app, exactly as Android delivered it |
linkId | Lander link ID, or null when the link is unknown to Lander |
url | Canonical short link, for example https://acme.golander.link/p-123 |
path | The in app route set on the link, for example /product/123 |
params | Link params, with the opened URL's query parameters merged over them |
campaign, channel | Attribution labels set on the link |
isDeferred | True when the link was recovered after an install or handed off after sign in |
confidence | DETERMINISTIC, PROBABILISTIC or UNATTRIBUTED |
method | How the link was tied to the open: app_link, install_referrer, landing_page, authenticated_handoff or probabilistic_match |
isResolved | Whether Lander recognized the link |
route | path when resolved, otherwise the raw URL's path and query |
How delivery works:
This is the beginning of the README. Read the rest at the original. Read the full README ↗