> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/products/idv-suite/flujos-and-integraciones/configuracion-tecnica-del-cliente/sdk-mobile/android-sdk/inicializacion.md).

# Initialization

## What is IDV Mobile

**IDV (Identity Verification)** is the Flow that allows verifying and authenticating a person's identity through the capture and validation of **biometric traits**.

The Flow is configured beforehand on the **Facephi platform** and is executed in the application through its identifier (`flowId`).

## Required dependencies

To run IDV Flows on Android, you must add, in addition to the base SDK, the **specific components** that take part in the process.

```kotlin
implementation("com.facephi.androidsdk:sdk:$version") 
implementation("com.facephi.androidsdk:tracking_component:$version") 
implementation("com.facephi.androidsdk:selphi_component:$version") 
implementation("com.facephi.androidsdk:selphid_component:$version")
implementation("com.facephi.androidsdk:video_recording_component:$version")
implementation("com.facephi.androidsdk:nfc_component:$version")
```

> Add only the components needed according to the Flow configured on the platform. The SDK and Tracking components must be integrated **mandatorily** regardless of the required Flow.

To facilitate the Integration process, a table is provided that refers to the dependency of each component:

<table data-full-width="true"><thead><tr><th width="166.7890625">Component</th><th>Dependency</th><th>Controller</th></tr></thead><tbody><tr><td>Selfie</td><td>com.facephi.androidsdk:selphi_component</td><td><code>FSelphiController</code></td></tr><tr><td>Selfie (with IAD functionality)</td><td>com.facephi.androidsdk:selphi_iad_component</td><td><code>FSelphiController</code></td></tr><tr><td>Document</td><td>"com.facephi.androidsdk:selphid_component</td><td><code>FSelphIDController</code></td></tr><tr><td>Video recording</td><td>com.facephi.androidsdk:video_recording_component</td><td><code>FStartVideoRecordingController</code> / <code>FStopVideoRecordingController</code></td></tr><tr><td>NFC</td><td>com.facephi.androidsdk:nfc_component</td><td><code>FNFCController</code></td></tr></tbody></table>

## SDK Initialization <a href="#iniciacion-de-sdk" id="iniciacion-de-sdk"></a>

The SDK is managed through a main controller (`SDKController`) that must be initialized before launching any Flow.

The **License apiKey** is provided by the Facephi team once [the Integration has been published](/docs.facephi-en/products/idv-suite/flujos-and-integraciones/integraciones-no-code-low-code.md).

```kotlin
val sdkConfig = SdkConfigurationData(
    sdkApplication = SdkApplication(application),
    licensing = LicensingOnline(EnvironmentLicensingData(
        apiKey = "..."
    )),
    trackingController = TrackingController()
)
val result = SDKController.initSdk(sdkConfig)
when (result) {
    is SdkResult.Error -> {
        Log.d("INIT SDK ERROR: ${result.error}")
    }
    is SdkResult.Success -> {
        Log.d("INIT SDK OK")
    }
}
```

After a successful Initialization, the SDK is ready to execute the configured Flows.

## Launch an IDV Flow <a href="#lanzamiento-de-idv" id="lanzamiento-de-idv"></a>

The IDV Flow is launched through a `FlowController`, indicating:

* The **Flow ID** configured on the platform (`flowId`).
* The **Customer ID** (`customerId`).
* The list of **controllers** that participate in the process.
* Optionally, the **authentication ID** (`authenticationId`) to associate the Flow with a specific authentication.
* Optionally, the identifiers `resumeOperationId` and `resumeSessionId` to continue an existing operation or session.

Common controller examples:

* `FSelphiController` → Face Capture.
* `FSelphIDController` → Document capture.
* `FStartVideoRecordingController` / `FStopVideoRecordingController` → Process recording.

```kotlin
val flowController = FlowController (
     FlowConfigurationData(
            id = "flowId",
            controllers = listOf(FSelphiController(), FSelphIDController()),
            customerId = "customerId",
            authenticationId = "authenticationId",
            resumeOperationId = "operationId",
            resumeSessionId = "sessionId",
        ))
SDKController.launch(flowController)

```

If you do not need to resume an operation, you can omit `authenticationId`, `resumeOperationId` and `resumeSessionId`. The SDK will create the internal identifiers during Flow startup.

To receive the Flow output, observe `stateFlow` before or during launch:

```kotlin
viewModelScope.launch {
    flowController.stateFlow.collect { flowResult ->
        val result = flowResult.result
        when (result) {
            is SdkResult.Success -> {
                val step = flowResult.step
                val data = result.data
                val isFlowFinished = flowResult.flowFinish
            }
            is SdkResult.Error -> {
                val error = result.error
            }
        }
    }
}
```

Each emission returns an `SdkFlowResult` with the step (`step`), the result of the step or operation (`result`) and the `flowFinish`, which indicates whether the Flow has finished.

## Check available Flows

If you need to retrieve the available Flows before launching one of them, use:

```kotlin
val list = SDKController.getFlowIntegrationData()
```

The function returns a list with the **Flow IDs** and its **operation type**.
