Title
Create new category
Edit page index title
Edit category
Edit link
Mobile
Mobile Face Capture Module (FCM) uses native APIs for face detection and image processing, which keeps our library small in size. This module leverages Google ML Kit for Android and Apple's Vision Library for iOS. Facial images are captured with the front-facing camera. The captured frames are analysed by the module and are cropped automatically, which can then be sent to the Yoti backend API for the age estimation & liveness check.
SICAP is currently only supported in Web FCM. If you prefer to use mobile-native FCM, you should implement code obfuscation, signature verification and encryption within your own application to block injection attacks.
There are two steps to integrate the Mobile FCM:
- Install the dependency
- Integrate the module into your application
Install the dependency
Yoti currently supports:
- Android
- iOS
- React Native
Prerequisite
| System requirements | Minimum supported version |
|---|---|
| Android SDK/API Level | 21 |
Camera permission is required to allow capturing the facial image.
xxxxxxxxxx<uses-feature android:name="android.hardware.camera.any" /> <uses-permission android:name="android.permission.CAMERA" />Installation
We offer two options, bundled and unbundled, to add this module to your app.
| Version | Size (armeabi-v7a) | Size (arm64-v8a) | Description |
|---|---|---|---|
| Bundled | 11.6 MB | 15.2 MB | This includes an embedded model for face detection. |
| Unbundled | 2.3 MB | 2.7 MB | Face detection model will be installed via Google Play Services at the first application launch. |
(1) Bundled version
To integrate the bundled version, simply add the line below to the gradle.properties file.
xxxxxxxxxximplementation 'com.yoti.mobile.android:face-capture-bundled:4.8.1'(2) Unbundled version
To integrate the unbundled version, add the following line to the gradle.properties file.
xxxxxxxxxximplementation 'com.yoti.mobile.android:face-capture-unbundled:4.8.1'It is recommended to add the following metadata to your manifest.xml to get the model downloaded as soon as the app is installed.
xxxxxxxxxx<application ...> ... <meta-data android:name="com.google.firebase.ml.vision.DEPENDENCIES" android:value="face" /></application>Example integration
Below is the example code for FCM integration.
xxxxxxxxxximport com.yoti.mobile.android.capture.face.demo.Rimport com.yoti.mobile.android.capture.face.ui.models.camera.CameraConfigurationimport com.yoti.mobile.android.capture.face.ui.models.face.FaceCaptureConfigurationimport com.yoti.mobile.android.capture.face.ui.models.face.ImageQuality // Configure the cameraval cameraConfiguration = CameraConfiguration() // Configure your moduleval configuration = FaceCaptureConfiguration( FaceCaptureConfiguration.FACE_CENTER, ImageQuality.MEDIUM, requireValidAngle = true, requireEyesOpen = true, requireBrightEnvironment = true, requiredStableFrames = 3, provideLandmarks = true, provideSmileScore = true, isSelfCheckOutMode = false) // Retrieve your viewval faceCapture = findViewById < FaceCapture > (R.id.faceCapture) // Start the camerafaceCapture.startCamera(this, :: onCameraState, cameraConfiguration) // Start the analysisfaceCapture.startAnalysing(configuration, :: onFaceCaptureResult)More details can be found in our GitHub repository. A sample app is available here for reference.
Error codes
| Error code | Description |
|---|---|
FaceNotStraight | The picture must be taken with a tilt angle no bigger than 30 degrees. |
EyesClosed | Eyes must be open when taking the photos. |
EnvironmentTooDark | The environment luminosity is below a pre-determined threshold. Try again with a brighter environment. |
FaceNotStable | Blurry images are being captured. A number of frames are taken as similar as possible in terms of width/height and x/y position. |
AnalysisError | The device is not compatible with the SDK, and the capture analysis cannot be performed. We recommend that you fall back to manual capture mode (for details, please check the sample app) if this error happens, so that the user can perform a manual capture. |
NoFaceDetected | Face is not detected in the capture area. |
MultipleFacesDetected | Multiple faces are detected in the view. Only one face is allowed. |
FaceTooSmall | The face is too small. Move closer to the camera. |
FaceTooBig | The face is too big. Move away from the camera. |
FaceNotCentered | The face is not positioned at the center of the camera. |
Got a question? Contact us here.