> For the complete documentation index, see [llms.txt](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/integration-methods/sdk/ios-sdk/liveness-integration.md).

# Liveness Integration

## **Import VidaLivenessDetector**

Start by importing the `VidaLivenessDetector` class into your application’s activity.

## **Create VidaLivenessDetector Instance**

Use the `LivenessDetectionBuilder` class to create an instance of the `VidaLivenessDetector` class. You can specify the detection configurations through the builder.

```java
VidaLivenessDetector detector = VidaLivenessDetector.LivenessDetectionBuilder.newInstance(/* ...config params... */).build();
```

## **Initialize the Detector**

Call the `initialize()` API of the `VidaLivenessDetector` class to initialize the liveness detection engine.

```java
detector.initialize();
```

When the initialization is successful, the `onInitialised()` callback method of the `VidaLivenessListener` interface is invoked.

## **Start Liveness Detection**

Once the detector is initialized, you can start the liveness detection by calling the `startDetection()` API.

```java
detector.startDetection();
```

This API starts the camera and begins the liveness detection process. It captures image frames and analyzes them to determine if the detected face is live or a spoof.

## **Stop Liveness Detection**

If, for any reason, you want to stop the liveness detection process prematurely or upon completion, you can call the `stopDetection()` method of the `VidaLivenessDetector` class.

```java
detector.stopDetection();
```

## **Release Resources**

After the liveness process is complete, it is essential to release the resources used by the SDK. Call the `release()` API to free up the resources.

```java
detector.release();
```

## LivenessDetectionBuilder

The `LivenessDetectionBuilder` provides optional configurations for the liveness detection process:

1. **Detection Timeout**: Set the overall timeout for face detection on the front end (FE) using `setDetectionTimeout()`. This parameter defines the maximum time the detector should wait to detect a face in the frame.
2. **Minimum Frame**: Set the minimum number of continuous frames that satisfy the quality parameters using `setMinimumFrame()`. These frames are used for stable image capture and liveness analysis.
3. **Eye Open Probability**: Define the probability of eye openness required for successful detection using `setEyeOpenProbability()`. For example, 20% or 30%.
4. **Minimum Preview Width and Height**: If you're using the SDK UI, you can set the minimum preview width and height for the camera view using `setMinimumPreviewWidth()` and `setMinimumPreviewHeight()`.

The `LivenessDetectionBuilder` provides optional configurations for the liveness detection process:

### LivenessDetectionBuilder

<br>
