Skip to content
CodeOnAir
Docs menu

Android SDK Setup

Add CodeOnAir AppLinks to a native Android app in Kotlin or Java: Gradle dependency, App ID, intent filters, App Links verification and deferred links.

The Android SDK supports minSdk 21. It uses the Play Install Referrer library for exact install attribution and never reads the advertising ID.

1. Install#

app/build.gradle.kts
dependencies {
  implementation("com.codeonair:deeplink-android:1.0.0") // from mavenCentral()
}

2. Add your App ID#

AndroidManifest.xml — inside <application>
<meta-data android:name="com.codeonair.APP_ID" android:value="proj_…" />

3. Initialize#

Application.kt
import com.codeonair.deeplink.DeepLink

class App : Application() {
  override fun onCreate() {
    super.onCreate()
    DeepLink.init(this) // reads com.codeonair.APP_ID from AndroidManifest.xml
  }
}
MainActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  DeepLink.onLink(this) { link -> navigate(link.path, link.params) }
}

override fun onNewIntent(intent: Intent) {
  super.onNewIntent(intent)
  DeepLink.handleIntent(intent) // links that open the app while it's running
}

5. Intent filters#

Use launchMode="singleTask" so a link reuses the running activity. Add one <data> line per link domain.

AndroidManifest.xml
<activity android:name=".MainActivity" android:launchMode="singleTask" 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="shop.codeonair.com" />
  </intent-filter>
  <!-- Optional: your URI scheme, for in-app browsers -->
  <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>
</activity>
Terminal
adb shell pm get-app-links com.yourcompany.app
# "verified" next to your domain means Android will open the app for it
Important
Apps from Google Play are signed with the Play App Signing key — that fingerprint must be in your URL prefix's App info, or verification fails.

More calls#

DeepLink.createLink(LinkOptions(path = "/p/1")) { result -> /* share result */ }
DeepLink.trackEvent("purchase")
DeepLink.setUserId("user-123")
Stuck? Write to support@codeonair.com with your App ID and what you tried — we reply within a working day.