> 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). Agents can also search and read this documentation through its [MCP server](https://docs.facephi.com/~gitbook/mcp).

# IDV Mobile Integration

## What is IDV Mobile

**IDV (Identity Verification)** is the Flow that allows a person's identity to be verified and authenticated by capturing and validating **biometric features**.

The Flow is configured in advance on the **Facephi platform** and is run 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** involved 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 components required for the flow configured on the platform.

## Initializing 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** 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("APP", "INIT SDK ERROR: ${result.error}")
    }
    is SdkResult.Success -> {
        Log.d("APP", "INIT SDK OK")
    }
}
```

{% hint style="info" %}
To run IDV flows, you must provide `trackingController` and use an online license (`LicensingOnline`), since the `apiKey` is used to retrieve the flows configured on the platform. Without `trackingController`, the flow returns the error `SDK_TRACKING_CONTROLLER_NULL`.
{% endhint %}

After successful initialization, the SDK is ready to run the configured flows.

## Launching an IDV flow <a href="#lanzamiento-de-idv" id="lanzamiento-de-idv"></a>

The IDV flow is launched using a `FlowController`, specifying:

* The **flow ID** configured on the platform (`flowId`).
* The **customer ID** (`customerId`).
* The list of **controllers** involved 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.
* `FVideoRecordingController` / `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 don't need to resume an operation, you can omit `authenticationId`, `resumeOperationId` and `resumeSessionId`. The SDK creates the internal identifiers when the flow starts.

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`, null if it does not correspond to a specific step), the result of the step or operation (`result`) and the `flowFinish`, which indicates whether the flow has finished. The first emission (with `step` null and `flowFinish` set `false`) contains the `OperationResult` for the operation created for the flow.

## 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 of `IntegrationFlowData` with the **flow ID** (`id`), its **operation type** (`operationType`) and its **name** (`name`). The list will be empty if the SDK has not been initialized or the flows could not be retrieved.
