WarpLink
SDKsAndroid

Deep Links

Handle App Links for Android deep linking with WarpLink.

When a user taps a WarpLink URL and your app is installed, Android opens your Activity via App Links. The SDK resolves the URI into a WarpLinkDeepLink with the destination, custom parameters, and attribution data.

Handle the intent in both onCreate() (cold start) and onNewIntent() (warm start).

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import app.warplink.WarpLink

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        handleIntent(intent)
    }

    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        handleIntent(intent)
    }

    private fun handleIntent(intent: Intent?) {
        intent?.data?.let { uri ->
            WarpLink.handleDeepLink(uri) { result ->
                result.onSuccess { deepLink ->
                    navigateTo(deepLink.destination)
                }.onFailure { error ->
                    Log.e("MyApp", "Deep link error: ${error.message}")
                }
            }
        }
    }
}
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import app.warplink.WarpLink

class MainActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent { MyApp() }
        handleIntent(intent)
    }

    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        handleIntent(intent)
    }

    private fun handleIntent(intent: Intent?) {
        intent?.data?.let { uri ->
            WarpLink.handleDeepLink(uri) { result ->
                result.onSuccess { deepLink ->
                    // Update navigation state or shared ViewModel
                }.onFailure { error ->
                    Log.e("MyApp", "Deep link error: ${error.message}")
                }
            }
        }
    }
}

The callback is always called on the main thread, so you can safely update UI from it.

Cold Start vs Warm Start

ScenarioEntry PointBehavior
Cold startApp not running — system launches ActivityonCreate() receives the intent with link URI
Warm startApp in background — brought to foregroundonNewIntent() receives the new intent

Both cases use the same handleIntent helper.

WarpLink.handleDeepLink(uri) { result ->
    result.onSuccess { deepLink ->
        Log.d("MyApp", "Link ID: ${deepLink.linkId}")
        Log.d("MyApp", "Destination: ${deepLink.destination}")

        // Android-specific deep link URL
        deepLink.deepLinkUrl?.let { url ->
            navigateToPath(url)
        }

        // Custom parameters
        val productId = deepLink.customParams["product_id"] as? String
        productId?.let { showProduct(it) }
    }
}

Error Handling

result.onFailure { error ->
    when (error) {
        is WarpLinkError.NotConfigured ->
            Log.e("MyApp", "Call configure() first")
        is WarpLinkError.InvalidUrl ->
            Log.e("MyApp", "Not a WarpLink URL")
        is WarpLinkError.LinkNotFound ->
            showLinkExpired()
        is WarpLinkError.NetworkError ->
            showOfflineMessage()
        is WarpLinkError.ServerError ->
            Log.e("MyApp", "Server error ${error.statusCode}: ${error.message}")
        else ->
            Log.e("MyApp", "Error: ${error.message}")
    }
}

Verify assetlinks.json

WarpLink generates the Digital Asset Links file automatically. Verify it:

curl https://aplnk.to/.well-known/assetlinks.json

Check App Links verification status:

adb shell pm get-app-links com.yourcompany.yourapp

If App Links aren't verified, try uninstalling and reinstalling the app. Android re-verifies assetlinks.json at install time.

On this page