Android
Migrate your Android app from Firebase Dynamic Links to Grovs for deep linking, link generation, and more.
Before you start: you need a Grovs account and the Grovs SDK in your project. See the Android SDK guide.
Steps
1. Initialization
Firebase Dynamic Links
No explicit initialization for link handling, but Firebase itself must be initialized.
Grovs
Call Grovs.configure() in your Application class:
import io.grovs.Grovs
import io.grovs.model.LogLevel
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
Grovs.configure(application = this, apiKey = "your-api-key", useTestEnvironment = false)
Grovs.setDebug(LogLevel.INFO) // Optional
}
}2. Universal Links and URL Handling
Firebase Dynamic Links
An intent filter in AndroidManifest.xml opens links:
<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:host="example.com"
android:scheme="https"/>
</intent-filter>Your activity reads the link:
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener { pendingDynamicLinkData ->
val deepLink: Uri? = pendingDynamicLinkData?.link
// Handle the deep link
}Grovs
Grovs uses similar intent filters. Take your_app_scheme, your_app_host and your_app_test_host from your Grovs project dashboard.
<intent-filter>
<data android:scheme="your_app_scheme" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<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="your_app_host" />
</intent-filter>
<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="your_app_test_host" />
</intent-filter>Add Grovs handling in onNewIntent() and onStart():
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
Grovs.onNewIntent(intent, this)
}
override fun onStart() {
super.onStart()
Grovs.onStart(this)
}Then listen for deep links with a listener:
Grovs.setOnDeeplinkReceivedListener(this) { deeplinkDetails ->
// Handle the deep link
val link = deeplinkDetails.link
val payload = deeplinkDetails.data
}Or with a flow:
Grovs.Companion::openedLinkDetails.flow.collect { deeplinkDetails ->
// Handle the deep link
}3. Generating Links
Firebase Dynamic Links
val shortLinkTask = Firebase.dynamicLinks.shortLinkAsync {
link = Uri.parse("https://www.example.com/")
domainUriPrefix = "https://example.page.link"
androidParameters { }
iosParameters("com.example.ios") { }
socialMetaTagParameters {
title = "Welcome to My App!"
description = "Some social description."
imageUrl = Uri.parse("https://www.example.com/images/social_preview.png")
}
}.addOnSuccessListener { (shortLink, flowchartLink) ->
// Link created
}.addOnFailureListener {
// Error
}Grovs
Platform parameters live in the Grovs dashboard, so the call only sets the link's content.
Grovs.generateLink(title = "Welcome to My App!",
subtitle = "Some social description.",
imageURL = "https://www.example.com/images/social_preview.png",
listener = { link, error ->
link?.let { link ->
// Link created
}
error?.let { error ->
// Error
}
})Or using Kotlin coroutines:
try {
val link = Grovs.generateLink(title = "Welcome to My App!",
subtitle = "Some social description.",
imageURL = "https://www.example.com/images/social_preview.png")
} catch (e: GrovsException) {
// Handle generation error
}4. User Identification and Attributes
Firebase Dynamic Links
Firebase uses FirebaseAuth for identity.
Grovs
Set identity and attributes directly:
Grovs.identifier = "user123"
Grovs.attributes = hashMapOf(
"name" to "Alice Smith",
"tier" to "Premium"
)Running both during the transition
Grovs works alongside Firebase and Firebase Dynamic Links. You can keep both integrations for a while to phase the switch.