Face


New library for face recognition. (Click to see more information)

Currently, we have new version of the SDK available. (Click to see more information)

9.7.34 🚀 Latest

The Face library allows you secure the user's identity through facial recognition. This library depends of your user case and is optional.

Contact to support for obtain the step for register in AKCore class.

Quick start


Add face as a dependency in your build.gradle app.

build.gradle:app
implementation 'com.autentikar:face:9.7.34'

Dependencies


FaceSDK depends on CoreSDK so you have to add CoreSDK as a dependency in your build.gradle app.

FaceSDK library depends on FaceTecSDK library current version is 9.7.34. This library is included in FaceSDK library from version 1.4.4. You don't need to add it as a dependency.

Set up


Initialize SDK

Before continuing, you can set up the SDK with the following code, we recommend that you do this in the Application class:

Kotlin
import com.autentikar.core.init.AKCore
import com.autentikar.core.data.types.AKStepType
import com.autentikar.facecapture.ui.view.AKStepFaceCaptureActivity
import com.autentikar.facecapture.init.AKFaceCapture

// version 1.4.11 and below
AKCore.register(AKStepFaceCaptureActivity(), AKStepType.yourStepProvidedBySupport)

// version 1.5.0 and above
AKCore.register(AKFaceCapture.getProtocol(AKStepType.yourStepProvidedBySupport))
Java
import com.autentikar.core.init.AKCore;
import com.autentikar.core.data.types.AKStepType;
import com.autentikar.facecapture.ui.view.AKStepFaceCaptureActivity;
import com.autentikar.facecapture.init.AKFaceCapture;

// version 1.4.11 and below
AKCore.register(new AKStepFaceCaptureActivity(), AKStepType.yourStepProvidedBySupport);

// version 1.5.0 and above
AKCore.register(AKFaceCapture.getProtocol(AKStepType.yourStepProvidedBySupport));

This will register the AKFaceCapture in the AKCore class. This activity will be launched to capture the user's face, and it is mandatory to register this activity in the AKCore class.

Custom Theme


For custom loading screen use AKFaceCaptureCustomization() function and call to setCustomization(customization: AKFaceCaptureCustomization). To custom view in FaceTec invoke the following code:

Kotlin
import com.autentikar.facecapture.init.AKFaceCapture
import com.autentikar.facecapture.ui.customization.AKFaceCaptureCustomization

private fun autentikarCustomUI() {
  val faceCaptureCustom = AKFaceCaptureCustomization()
  faceCaptureCustom.backgroundColor = Color.parse("#yourBackgroundColor")
  faceCaptureCustom.showBackgroundImage = true | false
  faceCaptureCustom.backgroundImage = R.drawable.your_background_image
  faceCaptureCustom.textColor = Color.parse("#yourTextColor")
  faceCaptureCustom.showLogo = true | false
  faceCaptureCustom.logo = R.drawable.yourLogo
  faceCaptureCustom.progressBarColor = Color.parse("#yourProgressBarColor")
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    faceCaptureCustom.customFontTypeface = resources.getFont(R.font.your_custom_font)
  } else {
    faceCaptureCustom.customFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
  }
  AKFaceCapture.setCustomization(faceCaptureCustom)
}
Java
import com.autentikar.facecapture.init.AKFaceCapture;
import com.autentikar.facecapture.ui.customization.AKFaceCaptureCustomization;

private void autentikarCustomUI() {
  AKFaceCaptureCustomization faceCaptureCustom = new AKFaceCaptureCustomization();

  faceCaptureCustom.setBackgroundColor(yourBackgroundColor);
  faceCaptureCustom.setTextColor(yourTextColor);
  faceCaptureCustom.setShowLogo(true | false);
  faceCaptureCustom.setLogo(R.drawable.yourLogo);
  faceCaptureCustom.setProgressBarColor(yourProgressBarColor);
  faceCaptureCustom.setShowBackgroundImage(true | false);
  faceCaptureCustom.setBackgroundImage(R.drawable.your_background_image);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    faceCaptureCustom.setCustomFontTypeface(getResources().getFont(R.font.your_custom_font));
  } else {
    faceCaptureCustom.setCustomFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf")); // example: Typeface.createFromAsset(assets, "fonts/your_custom_font.ttf")
  }
  // set customizations
  AKFaceCapture.setCustomization(faceCaptureCustom);
}

For customizing the Capture Face UI you need add a facetec-dependency dependency, this dependency is needed to use the FaceTecCustomization() function.

Properties

AKFaceCaptureCustomization class corresponds to the preloading screen. It has the following properties:

  • backgroundColor: The background color.
  • showBackgroundImage: Show or hide the background image (default is false).
  • backgroundImage: The background image (if showBackgroundImage is false this image not show).
  • showLogo: Show or hide the logo (default is true).
  • logo: The logo bottom (if showLogo is false this image not show).
  • progressBarColor: The color of progress bar.
  • textColor: The color of text.
  • customFontTypeface: The custom font typeface. Deprecated
  • fontTypeface: The custom font typeface. New

Texts


For change the texts of the preloading screen, you can override the following strings in your strings.xml file:

If you want to change the texts, you have to add strings.xml (es) file in your project for spanish language.
strings.xml
<!--Step Face Capture Activity-->
<string name="ak_face_start">Starting Face Capture</string>
<string name="ak_face_end">Ending Face Capture</string>
<string name="ak_face_result_screen_success_message">Confirmed\nCapture</string>
<string name="ak_card_start">Starting ID Card Capture</string>
<string name="ak_card_end">Ending ID Card Capture</string>

<!--Alert-->
<string name="ak_face_alert_ok">OK</string>
<string name="ak_face_not_capture_init_alert">Capture not started</string>
<string name="ak_face_capture_not_responding_alert">Face capture not responding. Try again</string>
<string name="ak_face_failed_capture">Failed to capture face.</string>
<string name="ak_face_invalid_capture">Invalid capture</string>
strings.xml (es)
<!--Step Face Capture Activity-->
<string name="ak_face_start">Iniciando Captura Facial</string>
<string name="ak_face_end">Finalizando Captura Facial</string>
<string name="ak_face_result_screen_success_message">Captura\nConfirmada</string>
<string name="ak_card_start">Iniciando Captura Cédula</string>
<string name="ak_card_end">Finalizando Captura Cédula</string>

<!--Alert-->
<string name="ak_face_alert_ok">OK</string>
<string name="ak_face_not_capture_init_alert">No se ha iniciado la captura</string>
<string name="ak_face_capture_not_responding_alert">No responde la captura facial. Intenta de nuevo</string>
<string name="ak_face_failed_capture">No se ha logrado capturar el rostro.</string>
<string name="ak_face_invalid_capture">Captura inválida</string>