Link Creation
Generate smart links programmatically in your Android app
Using a callback
Kotlin
Grovs.generateLink(
title = "Check out this product",
subtitle = "Limited time offer",
imageURL = "https://example.com/image.jpg",
data = mapOf("productId" to "12345", "screen" to "product_detail"),
tags = listOf("promotion", "share"),
customRedirects = null,
showPreviewIos = null,
showPreviewAndroid = null,
tracking = TrackingParams(
utmMedium = "share_button",
utmSource = "in_app",
utmCampaign = "spring_sale"
),
lifecycleOwner = this,
listener = { link, error ->
link?.let { Log.d("Grovs", "Generated: $it") }
error?.let { Log.e("Grovs", "Error: $it") }
}
)Using coroutines
Kotlin
lifecycleScope.launch {
try {
val link = Grovs.generateLink(
title = "Check out this product",
subtitle = "Limited time offer",
imageURL = "https://example.com/image.jpg",
data = mapOf("productId" to "12345"),
tags = listOf("promotion"),
tracking = TrackingParams(
utmCampaign = "spring_sale",
utmSource = "in_app",
utmMedium = "share_button"
)
)
Log.d("Grovs", "Generated: $link")
} catch (e: GrovsException) {
Log.e("Grovs", "Error: ${e.message}")
}
}Parameters
| Parameter | Type | Description |
|---|---|---|
title | String? | Link preview title |
subtitle | String? | Link preview subtitle |
imageURL | String? | Link preview image URL |
data | Map<String, Serializable>? | Custom payload delivered on deep link open |
tags | List<String>? | Tags for filtering and analytics |
customRedirects | CustomRedirects? | Override default redirect behavior |
showPreviewIos | Boolean? | Show link preview on iOS (uses dashboard default if null) |
showPreviewAndroid | Boolean? | Show link preview on Android (uses dashboard default if null) |
tracking | TrackingParams? | UTM tracking parameters |