High Accuracy OCR, Face Recognition & Liveness
  • Language
    • Overview
    • Android
      • Project Setup
      • Accura OCR
      • Accura Face Match
      • Accura Liveness
    • iOS
      • Project Setup
        • Check Pod Size
      • Accura OCR
        • Setup Accura License and Configurations
        • Set Camera View
      • Accura Face Match
      • Accura liveness
    • Flutter
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods and Adding Permissions.
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode and Bankcard
        • Facematch and Liveness
    • Cordova
      • Project Setup
      • Android Setup
        • Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Title & Error messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • React-Native
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Adding Permissions.
        • Adding License
      • Functions
        • Fetching License Details
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Xamarin
      • Project Setup
      • Android Setup
        • Adding Permission & Packages
        • Adding License
      • iOS Setup
        • Adding Permissions
        • Adding License
      • Functions
        • Fetching License details
        • Setup custom messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Docker
      • MRZ
      • FaceMatch
      • Face Liveness
      • ID Liveness
      • ID Forgery
    • Web API
      • Accura OCR
      • Accura Face Match
      • Accura Face Liveness
      • Accura ID Liveness
  • Solutions
    • MRZ
      • Android
        • SDK Setup
        • Setup Accura MRZ
      • iOS
        • SDK Setup
        • Setup Accura MRZ
      • Flutter
        • SDK Setup
        • Setup Accura MRZ
      • React Native
        • SDK Setup
        • Setup Accura MRZ
      • Cordova
        • SDK Setup
        • Setup Accura MRZ
    • OCR
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • Barcode with PDF417
      • Android
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • iOS
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Flutter
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • React Native
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Cordova
        • SDK Setup
        • Setup Accura Barcode with PDF417
    • Face Match
      • Android
        • Setup SDK
        • Setup Accura Face Match
      • iOS
        • Setup SDK
        • Setup Accura Face Match
      • Flutter
        • Setup SDK
        • Setup Accura Face Match
      • React Native
        • Setup SDK
        • Setup Accura Face Match
      • Cordova
        • Setup SDK
        • Setup Accura Face Match
    • Face Liveness (2D / Silent / Passive)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness (3D / Face Movement)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness with Voice Authentication
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Set up Accura Face Liveness
    • ⁠Document Liveness and ID Forgery
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • NFC scanner
      • Android
        • SDK Setup
        • Setup Accura NFC
      • iOS
        • SDK Setup
        • Setup Accura NFC
      • Flutter
        • SDK Setup
        • Setup Accura NFC
      • React Native
        • SDK Setup
        • Setup Accura NFC
      • Cordova
        • SDK Setup
        • Setup Accura NFC
    • Voice Biometrics
      • Android
        • Setup Voice Verification
      • iOS
        • Setup Voice Verification
      • Flutter
        • Setup Voice Verification
      • React Native
        • Setup Voice Verification
      • Cordova
        • Setup Voice Verification
    • Finger Biometrics
      • Android
        • SDK Setup
        • Setup Accura Finger
      • iOS
        • SDK Setup
        • Setup Accura Finger
      • Flutter
        • SDK Setup
        • Setup Accura Finger
      • React Native
        • SDK Setup
        • Setup Accura Finger
      • Cordova
        • SDK Setup
        • Setup Accura Finger
    • MICR Cheque scanner
      • Android
        • SDK Setup
        • Setup Accura MICR
      • iOS
        • SDK Setup
        • Setup Accura MICR
      • Flutter
        • SDK Setup
        • Setup Accura MICR
      • React Native
        • SDK Setup
        • Setup Accura MICR
      • Cordova
        • SDK Setup
        • Setup Accura MICR
Powered by GitBook
On this page
  • Add following code in Manifest.
  • Add following code to your Application class or MainActivity for hostname verification
  • Open camera for liveness Detectcion.
  • ProGuard
  1. Solutions
  2. Face Liveness with Voice Authentication
  3. Android

Setup Accura Face Liveness

Add following code in Manifest.

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
    ...
    android:networkSecurityConfig="@xml/network_security_config"
    >

 </application>
 
Note : 'android:networkSecurityConfig="@xml/network_security_config"' setup will permit clear text traffic   

Add following code to your Application class or MainActivity for hostname verification

new HostnameVerifier() {
    @Override
    public boolean verify(String hostname, SSLSession session) {
        HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
        return hv.verify("your url host name", session);
    }
};

Open camera for liveness Detectcion.

Must have to Grant camera permission

private final static int ACCURA_LIVENESS_CAMERA = 100;

// To customize your screen theme and feed back messages
LivenessCustomization livenessCustomization = new LivenessCustomization();

livenessCustomization.backGroundColor = getResources().getColor(R.color.livenessBackground);
livenessCustomization.closeIconColor = getResources().getColor(R.color.livenessCloseIcon);
livenessCustomization.feedbackBackGroundColor = Color.TRANSPARENT;
livenessCustomization.feedbackTextColor = Color.BLACK;
livenessCustomization.feedbackTextSize = 18;
livenessCustomization.feedBackframeMessage = "Frame Your Face";
livenessCustomization.feedBackAwayMessage = "Move Phone Away";
livenessCustomization.feedBackOpenEyesMessage = "Keep Your Eyes Open";
livenessCustomization.feedBackCloserMessage = "Move Phone Closer";
livenessCustomization.feedBackCenterMessage = "Move Phone Center";
livenessCustomization.feedBackMultipleFaceMessage = "Multiple Face Detected";
livenessCustomization.feedBackHeadStraightMessage = "Keep Your Head Straight";
livenessCustomization.feedBackBlurFaceMessage = "Blur Detected Over Face";
livenessCustomization.feedBackGlareFaceMessage = "Glare Detected";
livenessCustomization.feedBackLowLightMessage = "Low light detected";

//To customize the Loading message of Dialog Box when Liveness is success
livenessCustomization.feedbackDialogMessage = "Loading...";
//To customize the Feedback Processing message when Liveness is succes
livenessCustomization.feedBackProcessingMessage = "Processing...";

livenessCustomization.showlogo = 0; // Set 0 to hide logo from selfie camera screen
livenessCustomization.logoIcon = R.drawable.your_logo; // To set your custom logo
    
// LivenessCustomization.CAMERA_FACING_FRONT to set selfie camera       
// LivenessCustomization.CAMERA_FACING_BACK to set rear camera
livenessCustomization.facing = LivenessCustomization.CAMERA_FACING_FRONT;
    
// 0 for full dark face and 100 for full bright face or set it -1 to remove low light filter
livenessCustomization.setLowLightTolerence(-1/*lowLightTolerence*/);

// 0 for clean face and 100 for Blurry face or set it -1 to remove blur filter
livenessCustomization.setBlurPercentage(80/*blurPercentage*/); // To allow blur on face
                                                
// Set min and max percentage for glare or set it -1 to remove glare filter
livenessCustomization.setGlarePercentage(6/*glareMinPercentage*/, 99/*glareMaxPercentage*/);
livenessCustomization.setApiKey("add api key");

// Set Liveness Mode as required
// 1. LivenessMode.FACE_3D - To enable Face Movement
// 2. LivenessMode.VOICE   - To enable Oral Verification
// 3. LivenessMode.All     - To enable Face Movement and Oral Verification both
livenessCustomization.livenessMode = LivenessMode.VOICE;

//To customize Verified Sound
livenessCustomization.livenessVerifiedAlertSound = Your Uri;

//To customize Verified Animation when Liveness is successful
livenessCustomization.livenessVerifiedAnimation = R.drawable.approved_sign;

//<editor-fold desc="customization for LivenessMode.VOICE">
livenessCustomization.feedBackOralInfoMessage = "Say each digits out loud";
//To customize Voice Icon for Oral Verification in Liveness Window
livenessCustomization.voiceIcon = R.drawable.your_image;
//To customize Text Size and Color of verification code which is getting display on the middle of oval for voice verification
livenessCustomization.codeTextSize = 30;
livenessCustomization.codeTextColor = Color.WHITE;
//</editor-fold>

// must have to call SelfieCameraActivity.getCustomIntent() to create intent
Intent intent = SelfieCameraActivity.getCustomIntent(this, livenessCustomization, "your_url");
startActivityForResult(intent, ACCURA_LIVENESS_CAMERA);


// Handle accura liveness result.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        if (requestCode == ACCURA_LIVENESS_CAMERA && data != null) {
            AccuraVerificationResult result = data.getParcelableExtra("Accura.liveness");
            if (result == null) {
                return;
            }
            if (result.getStatus().equals("1")) {
                // result get bitmap of face by using following code
                Bitmap bitmap = result.getFaceBiometrics();
                double livenessScore = result.getLivenessResult().getLivenessScore();
                Toast.makeText(this, "Liveness Score : " + livenessScore, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, result.getStatus() + " " + result.getErrorMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    }
}

ProGuard

Depending on your ProGuard (DexGuard) config and usage, you may need to include the following lines in your proguards.

-keep public class com.docrecog.scan.ImageOpencv {;}
-keep class com.accurascan.ocr.mrz.model.* {;}
-keep class com.accurascan.ocr.mrz.interfaces.* {;}
-keep public class com.inet.facelock.callback.FaceCallback {*;}
-keep public class com.inet.facelock.callback.FaceDetectionResult {*;}
PreviousSDK SetupNextiOS

Last updated 1 month ago