Docs

API Reference

Complete Android SDK properties and methods reference

Properties

useTestEnvironment

Kotlin
Grovs.useTestEnvironment: Boolean

Set to true to enable the test environment.

identifier

Kotlin
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

Kotlin
Grovs.attributes: Map<String, Any>?

Get or set user attributes. These appear in the Grovs dashboard for user identification and behavior analysis.

openedLinkDetails

Kotlin
Grovs.openedLinkDetails: DeeplinkDetails?

Kotlin Flow that emits deep link details when the app is opened from a Grovs link.

pushToken

Kotlin
Grovs.pushToken: String?

Get or set the push notification token for receiving dashboard messages.


Methods

configure

Kotlin
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

Kotlin
fun setSDK(enabled: Boolean)

Enable or disable the SDK.

setDebug

Kotlin
fun setDebug(level: LogLevel)

Set the debug logging level. Options: INFO, ERROR.

onStart

Kotlin
fun onStart(activity: Activity)

Forward the launcher activity's onStart() to the SDK. Required.

onNewIntent

Kotlin
fun onNewIntent(intent: Intent?, activity: Activity)

Forward the launcher activity's onNewIntent() to the SDK. Required.

Kotlin
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.

Kotlin
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
): String

Generate a smart link using Kotlin coroutines.

setOnDeeplinkReceivedListener

Kotlin
fun setOnDeeplinkReceivedListener(launcherActivity: Activity, listener: GrovsDeeplinkListener)

Register a listener for deep link events.

displayMessagesFragment

Kotlin
fun displayMessagesFragment(onDismissed: (() -> Unit)?)

Display the messages list as a modal fragment.

numberOfUnreadMessages

Kotlin
suspend fun numberOfUnreadMessages(): Int?

Get the count of unread messages.

logInAppPurchase

Kotlin
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

Kotlin
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)

Kotlin
fun linkDetails(path: String, lifecycleOwner: LifecycleOwner? = null, listener: GrovsLinkDetailsListener)

Get link details via callback.

linkDetails (coroutine)

Kotlin
suspend fun linkDetails(path: String): Map<String, Any>

Get link details using Kotlin coroutines.


Types

DeeplinkDetails

Kotlin
class DeeplinkDetails {
    val link: String?
    val data: Map<String, Any>?
    val tracking: Map<String, Any>?
}

Contains information about a received deep link.

PropertyTypeDescription
linkString?The deep link URL that opened the app.
dataMap<String, Any>?Custom payload data attached to the link.
trackingMap<String, Any>?Attribution and tracking metadata associated with the link.

TrackingParams

Kotlin
class TrackingParams(
    val utmCampaign: String? = null,
    val utmSource: String? = null,
    val utmMedium: String? = null
)

UTM tracking parameters for link generation.

ParameterDescription
utmCampaignCampaign name (e.g. "spring_sale").
utmSourceTraffic source (e.g. "in_app").
utmMediumMarketing medium (e.g. "share_button").

PaymentEventType

Kotlin
enum class PaymentEventType {
    BUY,
    CANCELLATION,
    REFUND
}

The type of payment transaction. Used with logCustomPurchase.

ValueDescription
BUYA new purchase.
CANCELLATIONA cancelled subscription or purchase.
REFUNDA refunded transaction.

CustomRedirects

Kotlin
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

Kotlin
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

Kotlin
enum class LogLevel {
    INFO,
    ERROR
}

Controls the verbosity of SDK log output. Pass to setDebug(level:).

ValueDescription
INFOAll messages including informational logs.
ERRORErrors only (default).

GrovsException

Kotlin
class GrovsException : Exception

Thrown when a coroutine-based SDK call fails (e.g. generateLink).