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

# IDV Mobile Integration

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

## Initialize the SDK <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** it 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 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 using 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 the flow start.

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 result of the step or operation (`result`) and the `flowFinish`indicator, which indicates whether the flow has finished.

## Check available flows

If you need to obtain the available flows before launching one of them, use:

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

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