API Reference
Complete Android SDK properties and methods reference
Properties
useTestEnvironment
Grovs.useTestEnvironment: BooleanSet to true to enable the test environment.
identifier
Grovs.identifier: String?Get or set the user identifier. This value appears in the Grovs dashboard and reports. Typically set to your app's user_id.
attributes
Grovs.attributes: Map<String, Any>?Get or set user attributes. These appear in the Grovs dashboard for user identification and behavior analysis.
openedLinkDetails
Grovs.openedLinkDetails: DeeplinkDetails?Kotlin Flow that emits deep link details when the app is opened from a Grovs link.
pushToken
Grovs.pushToken: String?Get or set the push notification token for receiving dashboard messages.
Methods
configure
fun configure(application: Application, apiKey: String, useTestEnvironment: Boolean = false, baseURL: String? = null)Initialize the SDK with your API key. Call this in your Application.onCreate(). Pass a baseURL to connect to a self-hosted backend.
setSDK
fun setSDK(enabled: Boolean)Enable or disable the SDK.
setDebug
fun setDebug(level: LogLevel)Set the debug logging level. Options: INFO, ERROR.
onStart
fun onStart(activity: Activity)Forward the launcher activity's onStart() to the SDK. Required.
onNewIntent
fun onNewIntent(intent: Intent?, activity: Activity)Forward the launcher activity's onNewIntent() to the SDK. Required.
generateLink (callback)
fun generateLink(
title: String? = null,
subtitle: String? = null,
imageURL: String? = null,
data: Map<String, Serializable>? = null,
tags: List<String>? = null,
customRedirects: CustomRedirects? = null,
showPreviewIos: Boolean? = null,
showPreviewAndroid: Boolean? = null,
tracking: TrackingParams? = null,
lifecycleOwner: LifecycleOwner? = null,
listener: GrovsLinkGenerationListener
)Generate a smart link and receive the result via callback.
generateLink (coroutine)
suspend fun generateLink(
title: String? = null,
subtitle: String? = null,
imageURL: String? = null,
data: Map<String, Serializable>? = null,
tags: List<String>? = null,
customRedirects: CustomRedirects? = null,
showPreviewIos: Boolean? = null,
showPreviewAndroid: Boolean? = null,
tracking: TrackingParams? = null
): StringGenerate a smart link using Kotlin coroutines.
setOnDeeplinkReceivedListener
fun setOnDeeplinkReceivedListener(launcherActivity: Activity, listener: GrovsDeeplinkListener)Register a listener for deep link events.
displayMessagesFragment
fun displayMessagesFragment(onDismissed: (() -> Unit)?)Display the messages list as a modal fragment.
numberOfUnreadMessages
suspend fun numberOfUnreadMessages(): Int?Get the count of unread messages.
logInAppPurchase
fun logInAppPurchase(originalJson: String)Log a Google Play Billing purchase. Pass the originalJson from the Purchase object. The SDK extracts product ID, price, currency, and purchase token automatically.
logCustomPurchase
fun logCustomPurchase(
type: PaymentEventType,
priceInCents: Int,
currency: String,
productId: String,
startDate: InstantCompat? = InstantCompat.now()
)Log a custom purchase, cancellation, or refund. PaymentEventType is one of BUY, CANCELLATION, or REFUND.
linkDetails (callback)
fun linkDetails(path: String, lifecycleOwner: LifecycleOwner? = null, listener: GrovsLinkDetailsListener)Get link details via callback.
linkDetails (coroutine)
suspend fun linkDetails(path: String): Map<String, Any>Get link details using Kotlin coroutines.
Types
DeeplinkDetails
class DeeplinkDetails {
val link: String?
val data: Map<String, Any>?
val tracking: Map<String, Any>?
}Contains information about a received deep link.
| Property | Type | Description |
|---|---|---|
link | String? | The deep link URL that opened the app. |
data | Map<String, Any>? | Custom payload data attached to the link. |
tracking | Map<String, Any>? | Attribution and tracking metadata associated with the link. |
TrackingParams
class TrackingParams(
val utmCampaign: String? = null,
val utmSource: String? = null,
val utmMedium: String? = null
)UTM tracking parameters for link generation.
| Parameter | Description |
|---|---|
utmCampaign | Campaign name (e.g. "spring_sale"). |
utmSource | Traffic source (e.g. "in_app"). |
utmMedium | Marketing medium (e.g. "share_button"). |
PaymentEventType
enum class PaymentEventType {
BUY,
CANCELLATION,
REFUND
}The type of payment transaction. Used with logCustomPurchase.
| Value | Description |
|---|---|
BUY | A new purchase. |
CANCELLATION | A cancelled subscription or purchase. |
REFUND | A refunded transaction. |
CustomRedirects
class CustomRedirects(
val ios: CustomLinkRedirect? = null,
val android: CustomLinkRedirect? = null,
val desktop: CustomLinkRedirect? = null
)Override the default redirect behavior per platform when generating a link.
CustomLinkRedirect
class CustomLinkRedirect(
val link: String,
val openAppIfInstalled: Boolean = true
)A platform-specific redirect. When openAppIfInstalled is true, the app opens if installed; otherwise the link URL is always used.
LogLevel
enum class LogLevel {
INFO,
ERROR
}Controls the verbosity of SDK log output. Pass to setDebug(level:).
| Value | Description |
|---|---|
INFO | All messages including informational logs. |
ERROR | Errors only (default). |
GrovsException
class GrovsException : ExceptionThrown when a coroutine-based SDK call fails (e.g. generateLink).