requestId generated by the Create API, performs the silent network handshake, and reports progress through callbacks. Your backend confirms the final result via the Status Check API.
Requirements
| Requirement | Version |
|---|---|
compileSdk | 35 |
| Minimum SDK | 21 |
| Kotlin | 1.9.0+ |
| Gradle | 8.3.1+ |
Step 1: Add SDK dependency
Add the OTPLESS SDK to your app’sbuild.gradle:
Check the latest version of the SDK here. Make sure to synchronize your Gradle project to fetch the dependency.
Step 2: Smart Authentication (SNA) setup
Once the SDK is integrated, add the following line in your app’sAndroidManifest.xml inside the <application> tag:
AndroidManifest.xml
Step 3: Initialize the SDK
ImportOtplessSDK in your LoginActivity.kt:
LoginActivity— initialize inonCreate()LoginFragment— initialize inonViewCreated()
Replace
APP_ID with your actual App ID from the OTPLESS dashboard.Step 4: Start SNA with the requestId
Pass therequestId returned by the Create API to start():
Start polling the Status Check API from your backend immediately after calling
start(). The SDK callback and the server status run in parallel.Step 5: Handle callbacks
Callback reference
The SDK works in two steps — initialization andstart() — and each step has its own set of callbacks.
Step 1: Initialization callbacks
Emitted when you initialize the SDK (Step 3).| Callback | Meaning |
|---|---|
SDK_READY | SDK initialization completed. |
FAILED | SDK failed to initialize (e.g. statusCode 5003). |
Step 2: Start callbacks
Emitted after you invokestart() (Step 4).
| Callback | State | Meaning |
|---|---|---|
INITIATE | Non-terminal | SNA is being attempted after pre-checks pass. authType is SILENT_AUTH. |
ONETAP | Success — terminal | SNA completed successfully (Silent Mobile Verification). Returns token / idToken. |
AUTH_TERMINATED | Failed — terminal | Emitted in two cases: (1) pre-checks failed → terminated directly; (2) SNA was initiated and then failed/expired. |
For the
errorCode / statusCode values surfaced in SDK callbacks, see SDK Error Codes.Next step
Status Check API
Confirm the authoritative auth status from your server.