Skip to content
Indiana
Dashboard
Docs
Browse docs / Android / Kotlin integration

Android / Kotlin integration

Integrate the native SDK, isolate customer sessions and verify Play Sandbox purchases.

SDK 0.0.1Updated

1. Install the native SDK

Integrate the reviewed groove-grow module from packages/android into your Gradle project. Use its Gradle configuration for Android SDK, Kotlin and Play Billing dependencies.

These are repository source packages; public SPM or Maven distribution has not been certified. Verify identity and readHoldings before adding Funnel and store purchases.

2. Issue the current customer's session

  • Your backend verifies the app login, then identifies the customer and issues a short-lived customerToken using a Server Key bound to this App and Sandbox. Do not trust a customer identity supplied by the device.
  • Configure the SDK with the HTTPS API URL, App UUID and Sandbox scope. The server verifies the environment binding. Never ship Console sessions, Server Keys or Supabase secrets in the app.
  • The SDK keeps the token in memory. Refresh through your authenticated backend. Clear current customer data and authenticate again after 401 / 403.

Related:Identity and credential boundaries

3. Connect and read customer data

GrowSession.kt
import android.content.Contextimport ai.tinkerland.grow.*import java.util.UUID suspend fun connectGrow(context: Context, baseUrl: String,    projectId: UUID, customerToken: String, runToken: String): Pair<GrooveGrowClient, GrowFunnelSession> {    val client = GrooveGrowClient(context, GrowConfiguration(baseUrl,        GrowScope(projectId, GrowEnvironment.SANDBOX)))    client.identify(customerToken)    client.readHoldings()    return Pair(client, client.funnel(runToken))} // Add GrowFunnelView(activity, flow) to the host UI on its main thread.// Set onAuthenticate to obtain the current user's token from your backend.// Recover: client.recoverNativeOrders(context, verifiedHostRelay)// On sign-out: client.reset(); destroy the old Funnel view; client.close()

Connection checkpoint

Show connected only after readHoldings succeeds for the current customer. Preserve decimal credits. Cancel host tasks on account changes or navigation, reject late responses and clear the previous snapshot as a whole.

4. Bind and verify Sandbox store purchases

  • In Payment connections, configure and verify the Apple or Google connection for this App and Sandbox, then bind products. Store product identifiers, app identity and connection must agree.
  • Pass the current runToken to client.funnel and present GrowFunnelView. native_purchase queries the real Play Billing product, base plan and offer; use recoverNativeOrders(context, relay) on foreground or explicit restoration.
  • Closing a store sheet or receiving a client callback is not delivery proof. Wait for server verification and delivery. Retain the current orderId, receiptId and original command rather than starting another purchase. The authenticated host relay adds its Server Key and uses the current customerToken for double authentication; never ship the key to a device. The server owns Google acknowledge / consume.

5. Acceptance and recovery

Native acceptance criteria
ScenarioExpected result
First connectionHoldings match Console customer details; invalid, expired and cross-scope sessions are rejected.
Sign-out and account changeClear old data immediately; old requests cannot overwrite the new customer; authenticate again after restart.
Network loss and timeoutShow a retryable error without success; retry the original request after reconnection.
Purchase, restore and refundDeliver a real Sandbox transaction once; restoration does not duplicate grants; verified refunds and revocations reach entitlements and history.

Native acceptance criteria

  • First connection

    Expected result
    Holdings match Console customer details; invalid, expired and cross-scope sessions are rejected.
  • Sign-out and account change

    Expected result
    Clear old data immediately; old requests cannot overwrite the new customer; authenticate again after restart.
  • Network loss and timeout

    Expected result
    Show a retryable error without success; retry the original request after reconnection.
  • Purchase, restore and refund

    Expected result
    Deliver a real Sandbox transaction once; restoration does not duplicate grants; verified refunds and revocations reach entitlements and history.
Record the device or simulator, test App, store account, transaction and server receipts separately. HTTP fixtures, compilation, platform selection and this checklist do not certify the real store chain.