Usage

Minimum Requirements

  1. API Level for use is 21 (Android 5.0)

  2. Java 7

  3. Access to storage and camera

  4. AndroidX

Installation

Add the following lines of code to your project-level gradle to your repositories

maven {
      credentials {
         username “sdk”
         password “sdk123456”
      }
      url “http://www.valifystage.com/artifactory/libs-release/”
}

maven {
      url "http://jitpack.io"
}

Add the following lines of code to your app-level gradle to your dependencies

implementation 'com.valify:ValifyEKYC:$LATEST_VERSION’

Latest version Version 2.2.2

Authentication

In order to generate an access token that will be used in the SDK authentication settings, use our authentication service API.

Configuration

Declare the following Valify variables

private Valify valify;
private ValifyConfig.Builder valifyConfig;

Initialize your SDK in your activity or fragment as follows:

valify = new ValifyFactory(getApplicationContext()).getClient(); // Pass context
valifyConfig = new ValifyConfig.Builder();

Configure your SDK settings:

// required settings
valifyConfig.setBaseUrl("Base Url");
.setAccessToken ("Access Token");
.setBundleKey("Bundle Key");

// optional settings
.withOCR(Boolean ocr);
.withDocumentVerification(Boolean document_verification);
.withWatermark(Boolean watermark);
.withLiveness(Boolean liveness);
.withFaceMatch(Boolean face_match);
.withRating(Boolean rating);
.withTerms(Boolean terms);
.withTutorial(Boolean tutorial);
.withDataUpdating(Boolean data_updating);
.withoutPreviewData();      // use when you do not want to preview data

If you don’t specify any services, the following services will be set by default to “True” and the user will go through the complete eKYC process:

// default settings

.withOCR(Boolean ocr);
.withLiveness(Boolean liveness);
.withFaceMatch(Boolean face_match);
.withRating(Boolean rating);
.withTerms(Boolean terms);
.withTutorial(Boolean tutorial);
.withDataUpdating(Boolean data_updating);

If you use the Face Match service after the OCR or OCR w/ Verification service then the face in the front side image of the national ID captured during the OCR or OCR w/ Verification step will be used for comparison with the image captured during the Face Match step.

If you use the Face Match service separately, you need to either pass an image or a transactions id for a hit previously made to our OCR or OCR w/ Verification service for comparison with the image that will be captured for the user going through the SDK experience:

.withCustomFaceMatchImage(byte[] image);
.withCustomFaceMatchTransactionId(String frontTransactionId);

Depending on the image size, compress as follows:

imageBitmap = Bitmap.createScaledBitmap(
      bitmap, 
      (int)(imageBitmap.getWidth() * 0.8), 
      (int) (imageBitmap.getHeight() * 0.8),
      true);

// uncomment for images larger than 500 KB
// bitmap.compress(Bitmap.CompressFormat.JPEG, 10, stream);

// uncomment for images smaller than or equal to 500 KB 
// bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);

The default language of the SDK is English, to set it to Arabic add the following:

.setLanguage("ar");

To add your custom logo to the splash screen:

.withCustomizedLogo("int logoImageId");

Specify the number of instructions, length of each instruction, and the number of maximum number of trials for the liveness service as follows:

// default value is 4, range of allowed values is [1, 10]
.seLivenessNumOfInstruction(int livenessNumOfInstruction);

// default value is 10 seconds, minimum value is 5 seconds
.setLivenssTimerSeconds(int livenssTimerSeconds);

// minimum value is 1
.setLivenessNumOfTrials(int livenessNumOfTrials);

Remove the actions you do not want the user to perform for the liveness service as follows:

.withoutSmile();
.withoutCloseEyes();
.withoutLookLeft();
.withoutLookRight();

Start the Valify Service:

try {
      valify.startActivityForResult(MainActivity.this,1,
      valifyConfig.build());
} catch(ValifyException e) {
      e.printStackTrace();
}

Your activity should implement onActivityResult in order to receive the data collected from the process similar to the following example:

@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      valify.handleActivityResult(resultCode, data, new     
            Valify.ValifyResultListener()
            {
                  @Override
                  public void onSuccess(
                        String valifyToken,ValifyData valifyData) {}

                  @Override
                  public void onExit(
                        String valifyToken,String step, 
                        ValifyData valifyData) {}

                  @Override
                  public void onError(
                        String valifyToken,int errorCode, 
                        String step, ValifyData valifyData) {}
            });
}

In this callback, we call the method handleActivityResult from the Valify object which overrides onSuccess, onExit & onError:

  1. OnSuccess is only called when the user has completed the experience successfully. The Valify token (valifyToken), and the data collected (valifyData) are returned.

  2. OnExit is only called when the user exits the SDK voluntarily returning to the main app. The Valify token (valifyToken), step at which the user exited (step), and the data collected before exiting (valifyData) are returned to the app.

  3. OnError is only called when the user aborts as a result of an error. The Valify token (valifyToken), error code (errorCode), step at which the user exited (step), and the data collected before the error occurred (valifyData) are returned to the app.

Last updated