Native Kotlin SDK for Android deep linking. App Links with automatic assetlinks.json hosting, deferred deep linking, and install attribution. Compatible with Jetpack Compose and View-based apps.
In your app's build.gradle (Kotlin DSL):
dependencies {
implementation("ly.ulink:sdk:latest")
}Or with Groovy:
dependencies {
implementation 'ly.ulink:sdk:latest'
}Add intent-filter to your main Activity:
<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="yourapp.ulink.ly" />
</intent-filter>
</activity>import ly.ulink.sdk.ULink
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
ULink.configure(
context = this,
apiKey = "your-api-key"
)
}
}class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Handle link that opened the app
handleIntent(intent)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent?.let { handleIntent(it) }
}
private fun handleIntent(intent: Intent) {
ULink.handleIntent(intent) { link ->
link?.let {
// Route user based on link.path and link.parameters
val productId = it.parameters["product"]
val referralCode = it.parameters["ref"]
// Navigate to appropriate screen
}
}
}
}// Call on first launch to get link from pre-install click
ULink.getInitialLink { link ->
link?.let {
// User came from a link before installing
val referralCode = it.parameters["ref"]
val productId = it.parameters["product"]
// Navigate to appropriate content
// Credit referral, etc.
}
}Android App Links are verified deep links that open your app directly without showing a disambiguation dialog. When properly configured, your app is the default handler for links to your domain.
The android:autoVerify="true" attribute is required for App Links. Without it, Android won't verify your domain and users may see a chooser dialog. Make sure your package name and signing certificate SHA-256 are configured in your ULink project settings.
The ULink SDK works seamlessly with Jetpack Compose. Here's how to handle deep links in a Compose app:
@Composable
fun MyApp() {
val navController = rememberNavController()
// Handle deep links
LaunchedEffect(Unit) {
ULink.linkFlow.collect { link ->
link?.let {
// Navigate based on link
when (it.path) {
"/product" -> {
val productId = it.parameters["id"]
navController.navigate("product/$productId")
}
"/profile" -> {
navController.navigate("profile")
}
}
}
}
}
NavHost(navController = navController, startDestination = "home") {
composable("home") { HomeScreen() }
composable("product/{id}") { ProductScreen() }
composable("profile") { ProfileScreen() }
}
}Deferred deep linking preserves link context when a user doesn't have your app installed. ULink uses multiple attribution methods to ensure reliable matching.
Create a free account and get your API key. Most teams integrate in under 30 minutes.