Skip to main content

Migrate Firebase Dynamic Links on Android

The ULink Android SDK (sdk/android_ulink_sdk) exposes the same surfaces you relied on in Firebase—deep-link handling, session tracking, installation telemetry, and link creation. Follow these steps to replace Firebase dependencies inside your Android app.


1. Update dependencies

Add the SDK from Maven (or JitPack) as documented in sdk/android_ulink_sdk/README.md:

dependencies {
implementation("ly.ulink.sdk:android-sdk:1.0.0")
}

The binary already targets https://api.ulink.ly and surfaces every endpoint under /sdk/*.


2. Confirm dashboard setup

The overview page covers every prerequisite, so double-check those before touching code:

  • Configuration → Android: package name, SHA-256 fingerprint, URL scheme, store fallback.
  • Domains: at least one verified shared .shared.ly or custom host.
  • Links: every Firebase slug recreated with the right type (dynamic vs unified) and metadata.

That keeps this page focused on Android-specific SDK changes.


3. Initialize the SDK

Replace any Firebase FirebaseDynamicLinks.getInstance() calls with the ULink SDK initialization in your Application or first Activity:

import ly.ulink.sdk.ULink
import ly.ulink.sdk.ULinkConfig

class MyApplication : Application() {
override fun onCreate() {
super.onCreate()

val config = ULinkConfig(
apiKey = "ULINK_API_KEY_FROM_DASHBOARD",
baseUrl = "https://api.ulink.ly",
enableDeepLinkIntegration = true,
debug = BuildConfig.DEBUG
)

ULink.initialize(this, config)
}
}
  • enableDeepLinkIntegration = true registers the intent filters automatically so you do not have to manually forward intents from every activity.
  • If you need manual control, set it to false and call ULink.handleDeepLink(intent.data) from onNewIntent.

Where you previously subscribed to Firebase intents, listen to the ULink streams (see sdk/android_ulink_sdk/app/src/main/java/ly/ulink/sdk/ULink.kt):

class MainActivity : AppCompatActivity() {
private lateinit var ulink: ULink

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

ulink = ULink.shared

lifecycleScope.launch {
ulink.dynamicLinkStream.collect { resolved ->
handleDynamicLink(resolved)
}
}

lifecycleScope.launch {
ulink.unifiedLinkStream.collect { resolved ->
handleUnifiedLink(resolved)
}
}
}
}
  • dynamicLinkStream surfaces links that should drive in-app navigation (similar to Firebase dynamic deep links).
  • unifiedLinkStream surfaces links that might open the browser. Use app logic to decide whether to stay in-app or call startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(resolved.fallbackUrl))).

The Android SDK exposes ULinkParameters.dynamic / ULinkParameters.unified factory methods inside sdk/android_ulink_sdk/app/src/main/java/ly/ulink/sdk/models/ULinkParameters.kt. Use them before calling ULink.shared.createLink(...).

val parameters = ULinkParameters.dynamic(
domain = "links.shared.ly",
slug = "promo-2024",
iosFallbackUrl = "https://apps.apple.com/app/yourapp",
androidFallbackUrl = "https://play.google.com/store/apps/details?id=com.example.app",
fallbackUrl = "https://example.com/campaign",
parameters = mapOf("utm_source" to "android-app"),
socialMediaTags = SocialMediaTags(
ogTitle = "Promo 2024",
ogDescription = "Redeem inside the app",
ogImage = "https://example.com/og.png"
)
)

lifecycleScope.launch {
val response = ULink.shared.createLink(parameters)
if (response.success) {
Log.d("ULink", "Created short URL: ${response.url}")
} else {
Log.e("ULink", "Failed: ${response.error}")
}
}

Under the hood this hits POST /sdk/links, using the same payload as the dashboard and respecting your verified domains.


6. QA and rollout

  1. Use GET https://api.ulink.ly/sdk/resolve?url=https://links.shared.ly/YOUR-SLUG to make sure the backend returns the expected routing.
  2. Run the Testing Deep Links guide on emulators/devices with the new URLs.
  3. Monitor Dashboard → Links → Analytics to confirm clicks and MAU metrics populate once the app is live.

With these changes, your Android app no longer depends on Firebase Dynamic Links and leans entirely on the ULink SDK plus the /sdk/* endpoints.