# Sample Application

{% embed url="<https://www.youtube.com/watch?v=9HM70PFa4lQ>" %}
NIST FRVT #1 Face Recognition, Liveness Detection Mobile SDK Demo
{% endembed %}

***

### Download APK

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Recognito_FaceDemo_Core.apk</td><td></td><td></td><td><a href="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FbxazG65b0ucb2DZyVfDb%2Fandroid2.png?alt=media&#x26;token=49249ec3-b0c5-494a-829b-76f7b363d40a">android2.png</a></td><td><a href="https://www.dropbox.com/scl/fi/qnbkc85vr0wn51vz60uxd/Recognito_FaceDemo_Core.apk?rlkey=lfaaectsm5ogob059bhy5zt12&#x26;st=tbxukqwn&#x26;dl=0">https://www.dropbox.com/scl/fi/qnbkc85vr0wn51vz60uxd/Recognito_FaceDemo_Core.apk?rlkey=lfaaectsm5ogob059bhy5zt12&#x26;st=tbxukqwn&#x26;dl=0</a></td></tr><tr><td>Recognito_FaceDemo_Pro.apk</td><td></td><td></td><td><a href="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FbxazG65b0ucb2DZyVfDb%2Fandroid2.png?alt=media&#x26;token=49249ec3-b0c5-494a-829b-76f7b363d40a">android2.png</a></td><td><a href="https://www.dropbox.com/scl/fi/rorednk17ix1oiur3mfl5/Recognito_FaceDemo_Pro.apk?rlkey=651is196rn09ds2zusuckfl4o&#x26;st=au57e3fa&#x26;dl=0">https://www.dropbox.com/scl/fi/rorednk17ix1oiur3mfl5/Recognito_FaceDemo_Pro.apk?rlkey=651is196rn09ds2zusuckfl4o&#x26;st=au57e3fa&#x26;dl=0</a></td></tr></tbody></table>

***

## Build Project

### - Download and Open Project

* Download&#x20;
  * [**Recognito\_Face\_Android\_Core.zip\[33.6M\]**](https://www.dropbox.com/scl/fi/e280z1swaydfqqmqwrwev/Recognito_Face_Android_Core.zip?rlkey=p4hwhfsdsiuedrqfkx45v43hz\&st=krs7lcl7\&dl=0)
  * [**Recognito\_Face\_Android\_Pro.zip\[46.7M\]**](https://www.dropbox.com/scl/fi/rkkxs7wi9i4w1totg9bej/Recognito_Face_Android_Pro.zip?rlkey=fjy8hr09cdogpo5iok6vr0qim\&st=4a8bqaam\&dl=0)
* Open the `FaceRecognition` project in Android Studio.

### - Setting Up SDK License Key

* Add license to `assets/license` file:

{% code title="Android-FaceRecognition-FaceLivenessDetection/app/src/main/assets/license" lineNumbers="true" %}

```
 BsTr9o4f4R/rM3TxbCWVb/hrOJuOIdz8ArQ/t2IgQFFUQzGHOLNNaMJiK/fUfr5zo005zoTA/cm6 
 VoZ6iGl+/hZGA3R5T/VWwhxekbw8JVz9sNesU6rMG5+1cNSN75trH2tpzdCPZ28ZDnZlttmiuUoC 
 9QazRe1xKi5tUXa+xgIxzL0vE6UW2dLKWaEXjn3fSJfLxXWw0q+UZP0hQAXb5Y9Yl/NVi7y3d0xT 
 Vq6/weuMQkgLcNdLqFRvQXup0M9W/pvuhaubySAxHCKVY8wToygN2iM78cOkyyAbGVwZeGQP0Jfd 
 46VZo+w+KCNw355j3osVVMghrOcVZnfbp1dNyg== 
```

{% endcode %}

* Build Project.

### - Integration Guide

* Import FaceSDK

```kotlin
import com.bio.facesdk.FaceBox
import com.bio.facesdk.FaceDetectionParam
import com.bio.facesdk.FaceSDK
```

* Activate and Initialize FaceSDK

```kotlin
var ret = FaceSDK.setActivation(license_str)

if (ret == FaceSDK.SDK_SUCCESS) {
    ret = FaceSDK.init(assets)
}
```

* YUV to Bitmap for camera frame

```kotlin
override fun process(frame: Frame) {
    val bitmap = FaceSDK.yuv2Bitmap(frame.image, frame.size.width, frame.size.height, cameraOrientation)
    ...
```

* Set `FaceDetectionParam` and Detect Face

```kotlin
val faceDetectionParam = FaceDetectionParam()
faceDetectionParam.check_liveness = true
faceDetectionParam.check_liveness_level = SettingsActivity.getLivenessModelType(this)
faceDetectionParam.check_eye_closeness = true // available for pro version
faceDetectionParam.check_face_occlusion = true // available for pro version
faceDetectionParam.check_mouth_opened = true // available for pro version
faceDetectionParam.estimate_age_gender = true // available for pro version
var faceBoxes: List<FaceBox>? = FaceSDK.faceDetection(bitmap, faceDetectionParam)
```

* Extract Face Template

```kotlin
val faceBox = faceBoxes[0]
val templates = FaceSDK.templateExtraction(bitmap, faceBox)
```

* Calculate Similarity

```kotlin
val similarity = FaceSDK.similarityCalculation(templates, person.templates)
```

***

## Application UI

<div><figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2Fr8xhN67jOPKijVPGK5KW%2F1.png?alt=media&#x26;token=3c3def65-c962-46ee-93cb-9a1ddfee99a6" alt=""><figcaption></figcaption></figure> <figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FsDOc2iRUXGS1Ihj3UNav%2F2.png?alt=media&#x26;token=fc15ab91-deec-41b7-93e2-8373ffec4d68" alt=""><figcaption></figcaption></figure> <figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2F3z4l1uUlLTZyzqUArcBz%2F3.png?alt=media&#x26;token=b24ea4bd-b78e-4833-8fc5-18f7a50df063" alt=""><figcaption></figcaption></figure> <figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FdSGHAuFmWEkBjBc540N2%2F4.png?alt=media&#x26;token=0f6c93df-14c1-45e3-b0da-2695846dbd8a" alt=""><figcaption></figcaption></figure> <figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FcZ5JeEmTKUNOKYWFbiyO%2F5.png?alt=media&#x26;token=d1a2ca1b-4eca-4904-8e4c-9c51e95a7d3f" alt=""><figcaption></figcaption></figure> <figure><img src="https://3902005046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxiEW2bRNeDz3JZIL41gD%2Fuploads%2FAEw7L13QHdabBVQ6MBJ9%2F6.png?alt=media&#x26;token=0c9f94ec-f857-444c-b21b-cf9ef2c50a47" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.recognito.vision/face-liveness-detection-sdk/integration-guide/android/sample-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
