Android
How to install the Regula Face SDK.
Requirements
The minimum Android API level is 21.
Installation
The Face SDK for Android is available on Maven and can be included via Gradle.
- Add the Regula Maven repository to your
settings.gradle
:dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url "https://maven.regulaforensics.com/RegulaDocumentReader" } } }
- Then add the SDK as a dependency to your app-level
build.gradle
. Make suretransitive
is set totrue
:dependencies { implementation ('com.regula.face:api:+@aar') { transitive = true } }
Huawei Vision
Huawei Vision is used for face detection in video stream using Huawei services.
Devices that do not have Google Mobile Services (GMS) such as Huawei need to include the Huawei Vision library. This means that to run the Face SDK on a Huawei device or any other device that has GMS disabled, it is necessary to integrate the Huawei Vision library. In this case, the Huawei or Honor device is automatically identified, and Huawei Vision is used.
First of all, add the repository:
maven {
url 'https://developer.huawei.com/repo/'
}
Then add the dependency:
dependencies {
implementation ('com.regula.face:huawei-vision:+@aar') {
transitive = true
}
}
The setForceToUseHuaweiVision
flag is used in the configuration to force the use of the Huawei Vision library, it works only if the library is connected. So, on a device that is not Huawei and does not have Google Mobile Services, the Face SDK can work via the Huawei services.
LivenessConfiguration configuration = new LivenessConfiguration.Builder()
.setForceToUseHuaweiVision(true)
.build();
FaceSDK.Instance().startLiveness(context, configuration, livenessResponse -> {});
val configuration: LivenessConfiguration = Builder()
.setForceToUseHuaweiVision(true)
.build()
FaceSDK.Instance().startLiveness(context, configuration) { livenessResponse -> }
The same way, you can use setForceToUseHuaweiVision
with presentFaceCaptureActivity()
and matchFaces()
implying FaceCaptureConfiguration.Builder
and MatchFaceConfiguration.Builder
respectively.