Skip to content

The Holus SDK comes with a video recording screen to capture the identity document at different angles to check for the presence or absence of holograms in the ID

Notifications You must be signed in to change notification settings

frslabs/holus-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 

Repository files navigation

HOLUS SDK

version

The Holus SDK comes with a video recording screen to capture the identity document at different angles to check for the presence or absence of holograms in the ID. Available for limited countries only.

Table Of Content

Prerequisite

NOTE : Encryption of HOLUS SDK Result is under development

You will need a valid license to use the Holus SDK, which can be obtained by contacting support@frslabs.com .

Depending on the license - offline or online - you have opted for, the ping functionality to billing servers will be disabled or enabled. For instance, if you have opted for the offline SDK model, then there will be no server ping needed to our billing server to bill you. However, if you have chosen a transaction based pricing, then after each transaction, a ping request will be made to our billing server. This cannot be overrided by the App. A point to note is that if the ping transaction fails for any reason, the whole transaction will be void without any results from the SDK.

Once you have the license , follow the below instructions for a successful integration of Holus SDK onto your Android Application.

Android SDK Requirements

Minimum SDK Version - 21 or higher

Download

Using maven repository

Add the following code to your project level build.gradle file

allprojects { 
    repositories { 
        maven { 
            // Maven Url and Credentials for Holus SDK. 
            url "https://holus-android.repo.frslabs.space/"                  
            credentials { 
                username 'ENTER-USERNAME-HERE'
                password 'ENTER-PASSWORD-HERE' 
            }
        }
       
        // (OPTIONAL) Maven credentials for the Torus SDK
        // Include below code only for transaction based billing
        maven {
            url "https://torus-android.repo.frslabs.space/"
            credentials {
                username 'ENTER-USERNAME-HERE'
                password 'ENTER-PASSWORD-HERE' 
            }
        }
        
    }
}

After that, add the following code to your app level build.gradle file

// ...

    android {
    
        // ...
        
        defaultConfig { 
        
            // ...
        
            vectorDrawables.useSupportLibrary true 
        }
        
        aaptOptions {
            noCompress "tflite"
        }

        // ...
        
    }

// ...

And then, add the dependencies

// ...

dependencies {
    /* Android SDK Dependencies for Holus */ 
    implementation 'com.android.support:design:<version above 23.4.0>'      
    implementation 'com.android.support.constraint:constraint-layout:<version above 1.1.3>'
   
    // REQUIRED - Holus Core Dependency
    implementation 'com.frslabs.android.sdk:holus:1.0.0-beta20' 
    
    // REQUIRED - Holus Additional Depedencies 
    implementation 'org.tensorflow:tensorflow-lite:1.14.0'
    implementation 'com.google.android.gms:play-services-vision:17.0.2'
    
    // OPTIONAL - Holus billing dependencies
    // Required only if transaction based billing is enabled
    implementation('com.frslabs.android.sdk:torus:0.0.9')
    implementation('com.squareup.retrofit2:converter-gson:2.3.0')
    implementation('com.squareup.retrofit2:retrofit:2.3.0')
    implementation('com.google.code.gson:gson:2.8.5')
}

Setup

Permissions

Holus requires the camera permission to work properly

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package.name" >

    <!-- Required by Holus -->
    <uses-permission android:name="android.permission.CAMERA" />

    <!-- Optional - Required if transaction based billing is enabled -->
    <uses-permission android:name="android.permission.INTERNET" />  
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  
    <application>
      ...
    </application>

</manifest>

Proguard rules

Include below proguard rules only if transaction based billing is enabled

-keep class retrofit.** { *; }

-keepclasseswithmembers class * {
   @retrofit2.http.* <methods>;
}
-keepclasseswithmembers interface * {
   @retrofit2.* <methods>;
}

Quick Start

Initiating the Holus SDK

Initialize the Holus instance with the appropriate configurations to invoke the Holus Sdk

public class MainActivity extends AppCompatActivity implements HolusResultCallback {

    // ...

    /* Enter the Holus license key here */
    private String HOLUS_LICENSE_KEY = "ENTER_YOUR_LICENSE_KEY_HERE";
    
    /* (OPTIONAL)  Enter the Holus REST API credentials here */
    private String HOLUS_API_BASE_URL = "ENTER_BASE_URL_HERE",
            HOLUS_API_REFERENCE_ID = "ENTER_REF_ID_HERE",
            HOLUS_API_CRED1 = "ENTER_API_CRED1_HERE",
            HOLUS_API_CRED2 = "ENTER_API_CRED2_HERE";

    /* (OPTIONAL)  Enter the Holus encryption key here */
    private String HOLUS_ENCRYPTION_KEY = "ENTER_ENCRYPTION_KEY_HERE";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button callSdk = findViewById(R.id.call_sdk);
        callSdk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                /* Invoke the Holus Sdk */
                callHolusSdk();
            }
        });
    }

    public void callHolusSdk() {

        //Initialize the Holus Sdk Config object with the appropriate configurations
        HolusConfig holusConfig = new HolusConfig.Builder()
                .setLicenseKey(HOLUS_LICENSE_KEY)
                .setEncryptionKey(HOLUS_ENCRYPTION_KEY) //Optional
                .setHolusApiCredentials(new HolusApiCredentials(HOLUS_API_BASE_URL
                        ,HOLUS_API_REFERENCE_ID
                        ,HOLUS_API_CRED1
                        ,HOLUS_API_CRED2)) // Optional
                .build();
                
        //Call the Holus Sdk to start scanning
        Holus holus = new Holus(holusConfig);
        holus.start(this, this);
        
    }

    // ...

}

Handling the result

Your activity must implement HolusResultCallback to receive the result.

    // ...

    @Override
    public void onHolusSuccess(HolusResult holusResult) {
    
        if (holusResult != null) {
            //Make sure to delete/move video file stored in this path
            String holusVideoPath = holusResult.getHolusVideoPath();

            if(holusResult.isDocumentSpoofed()){
                // Document was detected to be spoofed/fake
            }else{
                // Document was detected to be original
            }
        }
    }

    @Override
    public void onHolusFailure(int errorCode) {
        /* Handle the Holus Sdk failure result here */
        Log.d(TAG, "onHolusFailure: Error: " + errorCode);
    }

    // ...

Holus Result

You can use the following methods in the HolusResult instance to parse the result:

Return Type Method Usage
String getHolusVideoPath() MP4 File Path of recorded video
boolean isDocumentSpoofed() Result of document spoof check (true is doucment is spoofed)
String getHolusSessionReferenceId() Reference Id corredponsing to the video

Holus Error Codes

Following error codes will be returned on the onHolusFailure method of the callback

CODE DESCRIPTION
803 Camera permission denied
804 Scan interrupted
805 Holus SDK License has expired
806 Holus SDK License is invalid

Holus Parameters

  • setLicenseKey(String holusLicenseKey) (Required)

    Accepts the Holus SDK licence key as a String

  • setEncryptionKey(String holusEncryptionKey) (Optional)

    Accepts the Holus SDK encrpytion key as a String . If set, the output video will be encrypted. Obtain the appropriate encryption key through a REST API call , for details about the REST API, contact support@frslabs.com

Help

For any queries/feedback , contact us at support@frslabs.com

About

The Holus SDK comes with a video recording screen to capture the identity document at different angles to check for the presence or absence of holograms in the ID

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published