Accura Liveness

User Authentication and Liveness Check Is Used for Customer Verification and Authentication.

Step 1: Before you begin

  1. If you haven't done already then follow Project Setup steps.

  2. Contact AccuraScan at contact@accurascan.com for Liveness SDK or API

  3. Required below permissions:

    1. Camera Permission android.permission.CAMERA

    2. Required Interent Permission

    3. Storage Permission required only for print out debug logs.

Note: Enable logs using below methods for debugging. make sure disable it before release it. (Required Storage permission for logging). AccuraLivenessLog.setDEBUG(true); AccuraLivenessLog.refreshLogfile(activity); Log file will be stored in InternalStorage/Downloads/AccuraLivenessLog.txt

Step 2 : Open Liveness camera screen

  • Customize camera screen (Optional)

    // 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";
    livenessCustomization.feedbackDialogMessage = "Loading...";
    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*/);

  • Open Camera screen using android Intent.

    Intent intent = SelfieCameraActivity.getCustomIntent(this, livenessCustomization, "your_url");
    startActivityForResult(intent, ACCURA_LIVENESS_CAMERA);

Note: If you want to use default camera screen then create intent with null object. Intent intent = SelfieCameraActivity.getCustomIntent(this, null, "your_url");

  • Receive Capure Image and liveness score

    @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")) {
                    // get face image
                    Bitmap bitmap = result.getFaceBiometrics();
                    double livenessScore = result.getLivenessResult().getLivenessScore() * 100.0;
                    Toast.makeText(this, "Liveness Score : " + livenessScore, Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(this, result.getStatus() + " " + result.getErrorMessage(), Toast.LENGTH_SHORT).show();
                }
            }
        }
    }

Last updated