Android setup tutorial
Recreate the Kotlin example app that ships with the SDK, then tailor it to your product.
Before you start
- LinkMe workspace + app
- Android package name and SHA-256 fingerprint (debug + release if possible)
- Access to update Gradle files and the manifest
1. Configure your LinkMe app
- Portal → Apps → Create app (or open an existing entry).
- Enter the Android package ID and paste the SHA-256 certificate fingerprint.
- Generate an API key in App Settings → API Keys and copy both
appIdandappKey. - Confirm Install Referrer stay enabled—Android uses it for deferred attribution automatically.
2. Install the SDK and dependencies
// settings.gradle
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
// app/build.gradle
dependencies {
implementation("com.github.r-dev-limited:li-nk.me-android-sdk:0.2.8")
}
JitPack publishes every tag automatically—check jitpack.io/#r-dev-limited/li-nk.me-android-sdk if you need build details.
linkmekit already bundles the Install Referrer and Ad ID libraries, so no extra dependencies are needed unless you want to collect Ad ID (requires user consent + com.google.android.gms.permission.AD_ID).
3. Declare hosts in the manifest
<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" android:host="links.yourco.com" />
</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="yourapp" />
</intent-filter>
</activity>
LinkMe hosts assetlinks.json automatically for the domains configured in App Settings.
Manual deep-link config mapping
Use these values for your Android deep-link setup:
{
"hosts": ["links.yourco.com"],
"associatedDomains": ["links.yourco.com"],
"schemes": ["yourapp"]
}
What each field does and why it must be set:
hosts: your HTTPS deep-link domain(s). Map each host to an App Links intent filter (android:autoVerify="true").associatedDomains: keep this aligned withhostsfor cross-platform consistency; on Android this is the same host list you verify via Digital Asset Links.schemes: fallback custom URL scheme(s) for explicit scheme opens.
Why this is required:
- Without
hosts, Android has no verified App Links target and HTTPS links will open in browser/disambiguation flows. - Without
schemes,yourapp://...links cannot route into your app. - If host/scheme values do not match your manifest, deep-link routing will be unreliable.
Apply these values in the manifest:
hosts/associatedDomains→ HTTPS App Links intent filter:
<data android:scheme="https" android:host="links.yourco.com" />
schemes→ custom scheme intent filter:
<data android:scheme="yourapp" />
4. Initialize and handle intents
class App : Application() {
override fun onCreate() {
super.onCreate()
LinkMe.shared.configure(
context = this,
config = LinkMe.Config(
baseUrl = "https://links.yourco.com",
appId = BuildConfig.LINKME_APP_ID,
appKey = BuildConfig.LINKME_APP_KEY,
sendDeviceInfo = true,
includeAdvertisingId = false,
debug = BuildConfig.DEBUG,
),
)
LinkMe.shared.getInitialLink { payload ->
payload?.let(::routeUser)
}
LinkMe.shared.claimDeferredIfAvailable(this) { deferred ->
deferred?.let(::routeUser)
}
}
}
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
LinkMe.shared.handleIntent(intent)
LinkMe.shared.addListener { payload ->
routeUser(payload)
}
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
LinkMe.shared.onNewIntent(intent)
}
}
This mirrors the code path inside sdks/android/example-app and ensures direct, background, and deferred flows all resolve to the same routeUser helper.
5. Test with the example app
- Copy
sdks/android/example-appoutside the monorepo or open it directly in Android Studio. - Set
LINKME_APP_ID/LINKME_APP_KEYinlocal.properties(or Gradle properties). - Run the app and click a LinkMe slug to confirm direct opens. For deferred tests, install from the Play Store simulator by opening the link, uninstalling, then reinstalling via the Play Store intent.
Troubleshooting
adb shell pm get-app-links --user cur com.example.appshows whether Android trusts your domain.- Run
adb shell pm verify-app-links --re-verify com.example.appafter changing fingerprints or domains. - If links still fall back to the browser, allow them manually:
adb shell pm set-app-links --package com.example.app --allow all(helpful on test devices).
Next, move to the Android SDK reference for detailed API and payload documentation.
Common Issues
Links open Play Store:
- Verify intent-filter includes
android:autoVerify="true" - Ensure app was rebuilt and reinstalled after manifest changes
- Check domain verification status
- Verify
assetlinks.jsonis accessible and correctly formatted
Verification timing:
- Automatic verification occurs on install (within a few seconds)
- If verification fails, status is cached until manually re-verified or app reinstalled
- Existing users who installed before verification may need to enable manually