> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tolt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Android

> Claim partner codes, app links and Google Play installs for your Android app users.

The Tolt Android library claims a partner's code for an app user. Tolt then credits that partner with the purchases [RevenueCat](https://docs.tolt.com/integrations/revenuecat.md) reports for the same user. See [Mobile apps](https://docs.tolt.com/tracking/mobile-apps.md) for how it fits together.

![](https://mintcdn.com/tolt-29/zzPkjqmWP80fP3qw/images/logos/android.svg?fit=max\&auto=format\&n=zzPkjqmWP80fP3qw\&q=85\&s=ea99631e173b4d7845710f0371068cd4) Tolt.claim
POST /client/claims
&#x20;Tolt

Sent by the SDK

**claim**requestapp\_user\_id"user\_8f2k"code"SAM20"first\_seen\_at"2026-11-04T09:30Z"

In Tolt

**customer**cus\_7Lm2…customer\_id"user\_8f2k"partner"sam"statuslead

## Install

Add the library from Maven Central to your app module:

```kotlin build.gradle.kts theme={"system"}
dependencies {
  implementation("com.tolt:tolt-android:0.1.0")
}
```

It supports Android 5.0 (API 21) and later. It depends only on Kotlin coroutines and the Play Install Referrer library.

## Configure

Call `configure` once in your `Application` with your public key from **Settings → Integrations** in the dashboard. The SDK remembers the first launch, which the program's [claim window](https://docs.tolt.com/tracking/mobile-apps.md#claim-rules) counts from.

```kotlin App.kt theme={"system"}
import com.tolt.Tolt

class App : Application() {
  override fun onCreate() {
    super.onCreate()
    Tolt.configure(this, publicId = "YOUR_PUBLIC_KEY")
  }
}
```

## Claim a code

Claim the code when the user enters one. Pass the app user id you give RevenueCat. The claim functions suspend, so call them from a coroutine such as `lifecycleScope.launch`.

```kotlin Kotlin theme={"system"}
val result = Tolt.claim(
  code = "SAM20",
  appUserId = Purchases.sharedInstance.appUserID
)
```

Also store the code on the RevenueCat customer. If a purchase reaches Tolt before the claim, Tolt uses it to credit the partner.

```kotlin Kotlin theme={"system"}
Purchases.sharedInstance.setAttributes(
  Tolt.revenueCatAttributes("SAM20")
)
```

## Claim from a link

When a [partner app link](https://docs.tolt.com/tracking/mobile-apps.md#partner-app-links) opens your app with `tolt_click` or `tolt_code` in the URL, pass the `Uri` on. It returns `null` for links without either.

```kotlin MainActivity.kt theme={"system"}
override fun onNewIntent(intent: Intent) {
  super.onNewIntent(intent)
  val uri = intent.data ?: return
  lifecycleScope.launch {
    Tolt.claim(uri, appUserId = Purchases.sharedInstance.appUserID)
  }
}
```

Do the same with `intent.data` in `onCreate` for links that start the app. With a deep linking provider, read the click from its callback instead and call `Tolt.claimClick(clickId, appUserId)`.

## Claim a Google Play install

When the program has no deep link template and a **Google Play URL** is set, app links send Android users to Google Play with the code and click in the install referrer. Claim it when the app starts:

```kotlin Kotlin theme={"system"}
lifecycleScope.launch {
  Tolt.claimFromInstallReferrer(
    appUserId = Purchases.sharedInstance.appUserID
  )
}
```

It returns `null` when the install didn't come from a partner link. Each install's referrer is claimed once. If Google Play can't be reached, or the claim fails for a temporary reason, the next call tries again.

## Results and errors

`claim` returns a `ClaimResult` with a `status`:

| `status` | Meaning |
| - | - |
| `CLAIMED` | The user is now the partner's customer |
| `ALREADY_CLAIMED` | The user already had a partner. Nothing changed |

It throws a `ToltException`, or an `IOException` when the request can't reach Tolt:

| Exception | When |
| - | - |
| `NotConfigured` | `configure` wasn't called |
| `InvalidInput` | The code, click or app user id is empty |
| `CodeNotFound` | No active partner has this code or click, or the public key is wrong |
| `CodeConflict` | Two partners share the code, or the claim window has closed |
| `RateLimited` | Over 30 claims a minute from one IP |
| `Server` | Anything else, with the HTTP `status` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.