> For the complete documentation index, see [llms.txt](https://lumin-soft.gitbook.io/ekyc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lumin-soft.gitbook.io/ekyc/integration-guide/mobile-plugin/enroll-android-sdk.md).

# eNROLL Android SDK

This document is a guide for eNROLL Android SDK. In addition, following the below steps will help you learn how to add and use (eNROLL SDK) in your Android Application.

## REQUIREMENTS

* Minimum Android SDK 24
* Target API level 35
* Kotlin Version 2.1.0

## 2. INSTALLATION

1- Add eNROLL SDK dependency to the build.gradle (Module :app) file:

```bash
dependencies {
    implementation("com.github.LuminSoft:eNROLL-Android:latest")
}
```

* You can find the latest version <https://github.com/LuminSoft/eNROLL-Android/releases>

2- Add Maven Repository in settings.gradle file

```bash
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("http://maven.innovatrics.com/releases")
            isAllowInsecureProtocol = true
        }
        maven {
            url = uri("https://jitpack.io")
        }
    }
}
```

3- Add license file to your project:

![App Screenshot](https://lumin-soft.gitbook.io/~gitbook/image?url=https%3A%2F%2F3826285197-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FGM6tCcdsukNbOigN9U2m%252Fuploads%252FidXQqrhFFiMjXmehyKng%252FScreen%2520Shot%25202024-03-24%2520at%252010.41.22%2520AM.png%3Falt%3Dmedia%26token%3Dde6d2485-8d25-46fc-967b-2d875011f6cd\&width=768\&dpr=4\&quality=100\&sign=a4cdc785\&sv=1)

## 3. IMPORT

```bash
import com.luminsoft.enroll_sdk.*
```

## 4. USAGE

### Step 1: Initialize the SDK and create a callback object:

ℹ️ eNROLL.init function is used for Initializing eNROLL SDK instance to use it.

ℹ️ It’s a throws function so please put it in a try…catch blocs.

ℹ️ EnrollCallback object contains Success, Error and Get Request ID call backs

```bash
try {
    eNROLL.init(
        tenantId = "tenantId",
        tenantSecret = "tenantSecret",
        enrollMode = EnrollMode.ONBOARDING,
        environment = EnrollEnvironment.STAGING,
        enrollCallback = object : EnrollCallback {
            override fun success(enrollSuccessModel: EnrollSuccessModel) {
               Log.d(TAG, enrollSuccessModel.enrollMessage)
               if (enrollSuccessModel.exitStepCompleted) {
                   Log.d(TAG, "Exit step completed: ${enrollSuccessModel.completedStepName}")
                   Log.d(TAG, "Request ID: ${enrollSuccessModel.requestId}")
               }
            }

            override fun error(enrollFailedModel: EnrollFailedModel) {
                Log.d(TAG, enrollFailedModel.failureMessage)
                enrollFailedModel.applicantId?.let { 
                    Log.d(TAG, "Applicant ID: $it")
                }
            }

            override fun getRequestId(requestId: String) {
                Log.d(TAG, requestId)
            }
        },
        localizationCode = LocalizationCode.EN,
        googleApiKey = "googleApiKey",
        skipTutorial = false,
        applicantId = "applicationIdText",
        levelOfTrustToken = "levelOfTrustTokenText",
        correlationId = "correlationId",
        fontResource = R.font.itim_regular,
        enrollForcedDocumentType = EnrollForcedDocumentType.NATIONAL_ID_OR_PASSPORT,
        templateId = "templateId",
        contractParameters = "contractParameters",
        requestId = "",
        exitStep = null,
        appTheme = AppTheme(  // ← NEW: Unified theme configuration
            colors = AppColors(
                primary = Color(0xFF1D56B8),
                secondary = Color(0xFF5791DB)
            ),
            icons = AppIcons(
                logo = LogoConfig(
                    mode = LogoMode.CUSTOM,
                    asset = IconSource.Resource(R.drawable.company_logo)
                )
            )
        )
    )
} catch (e: Exception) {
    Log.e("error", e.toString())
}
```

### Step 2: launch SDK:

eNROLL.launch function is used for launching eNROLL SDK.

ℹ️ It’s a throws function so please put it in a try…catch blocs.

```bash
try {
    eNROLL.launch(this)
} catch (e: Exception) {
    Log.e(TAG, e.toString())
}
```

## 5. VALUES DESCRIPTION

.

| Keys.                | Values                                                                                                                                                                                                  |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tenantId`           | **Required**. Write your organization tenant id                                                                                                                                                         |
| `tenantSecret`       | **Required**. Write your organization tenant secret.                                                                                                                                                    |
| `enrollMode`         | **Required**. Mode of the SDK.                                                                                                                                                                          |
| `environment`        | **Required**. Select the EnrollEnvironment: EnrollEnvironment.STAGING for staging and EnrollEnvironment.PRODUCTION for production.                                                                      |
| `enrollCallback`     | **Required**. Callback function to receive success and error response.                                                                                                                                  |
| `localizationCode`   | **Required**. Select your language code LocalizationCode.EN for English, and LocalizationCode.AR for Arabic. The default value is English.                                                              |
| `googleApiKey`       | **Optional**. Google Api Key to view the user current location on the map.                                                                                                                              |
| `applicantId`        | **Optional**. Write your Application id.                                                                                                                                                                |
| `levelOfTrustToken`  | **Optional**. Write your Organization level of trust.                                                                                                                                                   |
| `skipTutorial`       | **Optional**. Choose to ignore the tutorial or not.                                                                                                                                                     |
| `appColors`          | **Optional**. (**Deprecated)**\*\*. Use `appTheme.colors` instead. Collection of app colors (primary, secondary, background, success, warning, error, text). Still supported for backward compatibility |
| `correlationId`      | **Optional**. Correlation ID to connect your User ID with our Request ID                                                                                                                                |
| `fontResource`       | **Optional**. Font Resource to set your font family                                                                                                                                                     |
| `templateId`         | **Optional**. The ID of the contract to be signed.                                                                                                                                                      |
| `contractParameters` | **Optional**. Extra contract parameters                                                                                                                                                                 |
| `requestId`          | **Optional**. Request ID to resume a previously started eKYC flow. Use this when continuing an incomplete onboarding process.                                                                           |
| `exitStep`           | **Optional**. Specify an EkycStepType to exit the SDK after completing that step. SDK returns control to your app with requestId for later resumption.                                                  |
| `appTheme`           | **Optional**. Unified theme configuration combining colors and icons. Use `AppTheme(colors = ..., icons = ...)` to customize the SDK's appearance. See Theme Customization section for details. \|      |

## 6. SECURITY NOTES

* Never hardcode `tenantSecret`, `levelOfTrustToken`, or API keys inside the mobile application. Use a secure storage mechanism or fetch them from your backend securely.
* Do not log sensitive user data (IDs, secrets, tokens) in production environments.
* Regularly update the SDK to the latest stable version for security patches.

## 7. EnrollMode Options

* `ONBOARDING` - Full user onboarding process
* `AUTH` - User authentication
* `UPDATE` - Update user profile
* `FORGET_PROFILE_DATA` - Forget/delete user profile data
* `SIGN_CONTRACT` - Digital contract signing

### 8. EXIT STEP & FLOW RESUME

The SDK supports partial flow execution where you can exit after a specific step and resume later.

#### Exit Step Configuration

Use the `exitStep` parameter to specify when the SDK should return control to your app:

```bash
eNROLL.init(
    // ... other parameters ...
    exitStep = EkycStepType.PhoneOtp  // Exit after phone OTP step
)
```

#### Resume Flow

When the SDK exits at your specified step, use the returned `requestId` to resume:<br>

```bash
// First time initialization with exit step
eNROLL.init(
    // ... parameters ...
    exitStep = EkycStepType.PhoneOtp
)

// Later, resume from where you left off
eNROLL.init(
    // ... parameters ...
    requestId = "previous_request_id",  // Resume flow
    exitStep = null  // Complete remaining steps
)
```

### 9. CALLBACK MODELS

#### EnrollSuccessModel

```bash
data class EnrollSuccessModel(
    val enrollMessage: String,           // Success message
    val documentId: String?,            // Document ID (if available)
    val applicantId: String?,           // Applicant ID (if available)  
    val requestId: String?,             // Request ID for resuming flows
    val exitStepCompleted: Boolean,     // True if exited at specified step
    val completedStepName: String?      // Name of completed exit step
)
```

```bash
data class EnrollFailedModel(
    val failureMessage: String,         // Error message
    val error: Any?,                   // Additional error details
    val applicantId: String?           // Applicant ID (if available)
)
```

### 10. THEME CUSTOMIZATION

The eNROLL SDK supports comprehensive UI customization through the unified `AppTheme` object, which combines color and icon customization.

#### 10.1 AppTheme Structure

```

data class AppTheme(
    val colors: AppColors = AppColors(),
    val icons: AppIcons = AppIcons()
)

```

Use `appTheme` parameter in `eNROLL.init()` to apply your custom theme:

```
eNROLL.init(
    // ... other parameters ...
    appTheme = AppTheme(
        colors = AppColors(/* custom colors */),
        icons = AppIcons(/* custom icons */)
    )
)
```

#### 10.2 Icon Customization Overview

Customize logos, tutorial icons, and UI elements. All icons are **optional** and fall back to beautiful default animations if not provided.<br>

```

data class AppIcons(
    val logo: LogoConfig = LogoConfig(),
    val location: LocationIcons = LocationIcons(),
    val nationalId: NationalIdIcons = NationalIdIcons(),
    val passport: PassportIcons = PassportIcons(),
    val phone: PhoneIcons = PhoneIcons(),
    val email: EmailIcons = EmailIcons(),
    val faceMatching: FaceMatchingIcons = FaceMatchingIcons(),
    val securityQuestions: SecurityQuestionsIcons = SecurityQuestionsIcons(),
    val password: PasswordIcons = PasswordIcons(),
    val signature: SignatureIcons = SignatureIcons(),
    val common: CommonIcons = CommonIcons(),
    val update: UpdateIcons = UpdateIcons(),
    val forget: ForgetIcons = ForgetIcons()
)
```

#### 10.3 Logo Customization

```
enum class LogoMode {
    DEFAULT,    // Show default eNROLL logo
    HIDDEN,     // Hide logo completely
    CUSTOM      // Use your custom logo
}

data class LogoConfig(
    val mode: LogoMode = LogoMode.DEFAULT,
    val asset: IconSource? = null,
    val renderingMode: IconRenderingMode = IconRenderingMode.ORIGINAL
)
```

#### 10.4 Icon Asset Requirements

**Supported Formats:**\
\- PNG, JPEG, WebP - Vector XML drawables (recommended)\
**Size Limits:**\
\- Max dimensions: 2048 × 2048 pixels - Max memory: 20 MB per icon \
\- Recommended: Keep under 500 KB \
**Location:** app/src/main/res/drawable/ app/src/main/res/drawable-xxxhdpi/ \
**Fallback Behavior:**\
If a custom icon fails validation (missing, too large, corrupt), the SDK automatically falls back to the default animated icon with a warning in logcat.

<br>
