> 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/sdks/sdk-mobile/android-sdk/inicializacion/integracion-idv-mobile.md).

# Integration IDV Mobile

## What is IDV Mobile

**IDV (Identity Verification)** is the Flow that allows you to verify and authenticate a person's identity through the capture and validation of **biometric features**.

The Flow is previously configured in 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 participate 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:capture_component:$version")
```

> Add only the necessary components according to the Flow configured on the platform.

## 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.

```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 **Client 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 the 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 a `SdkFlowResult` with the step (`step`), the step or operation result (`result`) and the `flowFinish`, which indicates whether the Flow has finished.

## Check available Flows

If you need to get the available Flows before launching one, use:

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

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