The mobile SDKs are available on request. Email support@grona.ai to get access.
Android API reference
This page lists the public API of ai.grona:grona-core:0.1.0. Every type is in the package ai.grona.sdk. Methods on Grona and the companion factories are annotated @JvmStatic, so Java callers use them as static methods.
The SDK never throws into your app, with one exception: GronaOptions.Builder.build() throws IllegalArgumentException on invalid input.
Options for Grona.init. Build with GronaOptions.Builder. build() throws on invalid input. Each builder method returns the Builder. Every option is also readable as a property of the same name on GronaOptions, except that keys are readable as the maps configKeys and grantKeys.
Builder member
Description
Builder(workspaceKey: String)
The workspace key, a public identifier, not a secret. Must match [A-Za-z0-9._:-]{1,128}.
fun configUrl(url: String)
Signed remote configuration (https). Without it the SDK runs on the bundled copy.
fun bundledConfigAsset(path: String)
Asset path of the signed bundled configuration, applied at launch and offline.
fun configKey(kid: String, publicKeySpki: String)
Trusted configuration signing key: base64 DER SubjectPublicKeyInfo of a P-256 key. Add current and next. At least one is required.
fun grantKey(kid: String, publicKeySpki: String)
Trusted grant signing key, same format as configKey.
fun eventsUrl(url: String)
Events endpoint (https). Without it the SDK sends no events and keeps no event queue. Debuggable builds keep the last 200 events in memory for the debug view.
fun previewUrl(url: String)
Preview pairing endpoint (https). Without it preview links only clear pins.
fun activationSource(source: GronaActivationSource)
Source of on and off answers from an external campaign system.
Highest quantity one action may add, 1 to 20. Default 5.
fun maxAddLines(max: Int)
Most lines one action may add, 1 to 20. Default 5.
fun sendPreConsentEvents(enabled: Boolean)
Send events buffered before consent once it is granted. Default false.
fun demoMode(enabled: Boolean)
Demo only, never in production. Takes effect only when the signed configuration also enables demo mode. Default false.
fun build(): GronaOptions
Validates and builds. Throws IllegalArgumentException for an invalid workspace key, a URL that is not https, no configKey, or add caps outside 1 to 20.
A place in your layout where Grona renders native components: banner, progress, offer and message. With nothing to show it stays laid out at zero height. Never set it GONE or INVISIBLE.
Member
Description
var placement: String
The placement. Usually set in XML with app:gronaPlacement. Set it before screen.
var screen: GronaScreen?
Starts the slot; rules read it. An equal value continues the visit; null ends it.
Commerce events your app forwards from its analytics layer. Money is in minor units; no search text, no full baskets. Exception: on keyed placements such as cart_line, campaign events carry the line’s product id as their key, in every arm. So while a cart_line campaign is live, the product ids of the cart lines bound to it leave the device.
Member
Description
fun viewItem(productId: String, priceMinor: Long): GronaEvent
A product view.
fun addToCart(productId: String, qty: Int, priceMinor: Long): GronaEvent
A cart add.
fun removeFromCart(productId: String, qty: Int): GronaEvent
A cart removal.
fun beginCheckout(totalMinor: Long): GronaEvent
Checkout started.
fun purchase(orderId: String, totalMinor: Long, productIds: List<String>, treatments: List<GronaTreatment>): GronaEvent
A confirmed order. productIds is the whole order; the SDK keeps only those Grona campaigns showed or added.
A money-bearing treatment. Display state only: your order backend applies it only after verifying token.
Member
Description
val campaignId: String
The campaign.
val variantId: String
The variant.
val placement: String
Where it was shown.
val type: String
The treatment type.
val valueMilli: Long
Value in thousandths, so 10000 is 10 (10% off with percent_off).
val token: String?
Grona-signed grant (compact JWS); null in demo mode. A real backend ignores a treatment without a token: no treatment, and the order still goes through.
val productId: String, val qty: Int; secondary constructor GronaLine(productId: String) with qty 1
One product and quantity in an action.
class GronaSource
val placement: String, val campaignId: String, val variantId: String
Which campaign and variant an action came from.
class GronaRoute
val type: String, val id: String?
A typed destination your app resolves itself. Grona never passes raw links.
HOME, PRODUCT, CATEGORY, CART, CHECKOUT, DEALS
Route type constants: "home", "product", "category", "cart", "checkout", "deals". Unknown types may arrive from newer configurations; return false from GronaHost.navigate for them.
Product facts from your app. Money is in minor units. Each builder value is also readable as a property: productId, name, priceMinor, wasPriceMinor, imageUri, inStock.
Visual tokens so SDK components match your app. Each value is also readable as a property: fontRegular, fontBold, primary, onPrimary, accent, surface, text, mutedText, cornerRadiusDp.
Member
Default
fun fonts(regular: Typeface?, bold: Typeface?): Builder
Receives SDK diagnostics. Silent by default; never given customer ids, baskets, tokens or keys.
GronaLogger.NONE
The silent default.
fun interface GronaActivationSource
fun activeExternalIds(): Set<String>?
On and off answers from an external campaign system. Called on a Grona background thread; may block up to 10 seconds. null when unknown. Activation can only switch campaigns off.
fun interface GronaGrantSource
fun fetchGrants(customerId: String): List<String>?
Fetches grants from your backend, which asks Grona’s server for them. Called on a Grona background thread; may block up to 10 seconds. Compact JWS grants, or null on failure.