> For the complete documentation index, see [llms.txt](https://docs.idlayr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.idlayr.com/get-started/sdks/android.md).

# Android SDK

{% hint style="info" %}
**Android** · Kotlin · `idlayr-sdk-android`
{% endhint %}

`idlayr-sdk-android` is IDlayr's Android SDK. It powers the device-side half of the two device APIs that require carrier-pinned cellular routing — **Secure SNA** and **Discovery** — by routing the verification request over the cellular data network and surfacing client-side errors in a predictable shape.

Reverse SMS is **not covered by this SDK**. Its device-side step is your app opening the native SMS composer via a `sms:` URL — see [Reverse SMS integration](/products/number-verification/reverse-sms/integration.md).

|                    |                                                                           |
| ------------------ | ------------------------------------------------------------------------- |
| Artifact           | `com.idlayr:idlayr-sdk-android`                                           |
| Latest version     | **2.4.0** (2026-06-29)                                                    |
| Language           | Kotlin                                                                    |
| `minSdk`           | 24                                                                        |
| `targetSdk`        | 36                                                                        |
| Java               | 11                                                                        |
| Distribution       | Cloudsmith Maven (private) — also available via Maven Central from v2.3.0 |
| Supported products | Secure SNA, Discovery                                                     |
| Versioning         | SemVer — see [SDK versioning](/get-started/sdks/versioning.md)            |

## 1. Install the SDK

You'll need a **Cloudsmith entitlement token** before Gradle can resolve the artefact. The token is shared by your IDlayr account team during onboarding. Store it as a build-time secret (e.g. `CLOUDSMITH_TOKEN` in your CI). Never check it into source control or include it in a published APK / AAB.

Add the private Cloudsmith Maven repository to your project's repositories list:

```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://dl.cloudsmith.io/basic/idlayr/sdk-android-maven/maven/")
            credentials {
                username = "token"
                password = System.getenv("CLOUDSMITH_TOKEN")
            }
        }
    }
}
```

Add the dependency to your app module:

```kotlin
// app/build.gradle.kts
dependencies {
    implementation("com.idlayr:idlayr-sdk-android:2.4.0")
}
```

`2.4.0` is the current version at the time of writing and works for apps on Kotlin 1.9.x or Kotlin 2.x. Teams already integrated on `2.3.6` (which requires Kotlin 2.x on the consuming app) do not need to upgrade — see the [v2.4.0 changelog entry](https://docs.idlayr.com/changelog/2026-06-29-android-sdk-2-4-0) for the Kotlin compatibility matrix. See [SDK versioning](/get-started/sdks/versioning.md) for how to select a version and the support policy.

## 2. Import and use

```kotlin
import com.idlayr.sdk.IDlayrSDK

val sdk = IDlayrSDK.getInstance()
```

The SDK **auto-initialises via an Android `ContentProvider`** (from v2.3.0 onwards). There is **no `initializeSdk(...)` call** — and `IDlayrSDK.getInstance()` is the entry point. If you're upgrading from a `tru-sdk-android` integration that called `initializeSdk(...)`, remove the call.

The exact method names depend on the product:

* **Secure SNA** — see [Secure SNA Android integration](/products/number-verification/secure-sna/integration/android.md).
* **Discovery** — see [Discovery Android integration](/products/number-verification/discovery/integration/android.md).

The per-product integration pages are the source of truth for SDK signatures. This page covers cross-cutting setup.

## 3. Cellular routing

For Secure SNA and Discovery, the SDK has to send the verification request **specifically over the cellular data network** — Wi-Fi breaks the carrier's ability to verify the SIM. On Android, the SDK acquires a `Network` instance bound to the cellular transport (`NetworkCapabilities.TRANSPORT_CELLULAR`) and routes the request through it, even when the device is also on Wi-Fi.

If the device has **no cellular data path at all** (airplane mode, no SIM, or a Wi-Fi-only tablet), the SDK returns `sdk_no_data_connectivity` and never attempts the request. Fall back to an alternate verification path in your app — for example, [Reverse SMS](/products/number-verification/reverse-sms.md), which works without cellular data and doesn't require the SDK at all.

## 4. 2G blocking

The SDK refuses to operate over insecure 2G networks (GPRS, EDGE, CDMA, 1xRTT, IDEN). Calls on a 2G connection return an error so your app can fall back gracefully.

## 5. Sandbox vs production

Sandbox is a **project mode**, not a separate SDK. The same `idlayr-sdk-android` artefact handles both — sandbox behaviour is driven by the project credentials your backend uses to mint the access token. See [Project modes](/get-started/concepts/project-modes.md).

## 6. SDK errors

`idlayr-sdk-android` surfaces errors via its callback/response shape. These are **client-side errors** raised before any HTTP request reaches IDlayr (or while the SDK processes a response locally) — they are not HTTP errors and have no RFC 7807 representation.

See [SDK errors](/get-started/sdks/errors.md) for the full cross-platform catalogue, the recommended action per code, and the difference between an SDK error and an API error. For server-side / HTTP errors (RFC 7807) returned during the same verification, see the per-product error pages — e.g. [Secure SNA error codes](/products/number-verification/secure-sna/error-codes.md).

## 7. Migrating from `tru-sdk-android`

| Legacy (`tru-sdk-android`)        | v1 (`idlayr-sdk-android`)                                                    |
| --------------------------------- | ---------------------------------------------------------------------------- |
| Public GitLab Maven               | Private Cloudsmith Maven (entitlement token required)                        |
| `id.tru.sdk:tru-sdk-android`      | `com.idlayr:idlayr-sdk-android`                                              |
| `import id.tru.sdk.*`             | `import com.idlayr.sdk.*`                                                    |
| `initializeSdk(...)` was required | Auto-initialised via `ContentProvider`; remove any `initializeSdk(...)` call |

There is no compatibility shim — migration is a one-time change of repository, dependency coordinates, imports, and the removal of the init call. See the SDK migration guide in Help Center for a full walkthrough.

## 8. Where to find the current version

The current Android SDK version is published on Cloudsmith. Android versions independently of iOS — see [SDK versioning](/get-started/sdks/versioning.md). For release notes, see the [Changelog](https://docs.idlayr.com/changelog).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.idlayr.com/get-started/sdks/android.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
