Skip to main content

Android SDK (Standard Version)

Attention

This documentation is for the Standard Version, encompassing foundational features. To access expanded capabilities and the latest advancements, we strongly recommend upgrading to the Enhanced Version

Getting Started

Latest Version: SDK Version

Requirements

Device Requirement

  • API level 23 (Android 6.0) or higher
  • Internet connection
  • Camera

Project Requirement

  • AndroidX Support

    • Shufti Pro SDK requires AndroidX 1.0.0 or later. If you haven't switched to AndroidX in your app yet then follow this guide.
  • Enable Java 8

    • Shufti Pro SDK requires Java 8 language features to be enabled in your project. If it is not already enabled, add this to your app/build.gradle file under the android section:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

Resources

Integration

SDK Integration Guide

Tip

It’s always recommended to use the updated version

Step 1: Go to root-level setting.gradle in your project and add the following:

setting.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this line
}
}

OR

Go to project > android > build.gradle file and add the following

allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add this line
}
}

Step 2: In build.gradle(Module) add the following implementation

app/build.gradle
implementation 'com.github.shuftipro:ShuftiPro_SDK:$Latest-Version'

You can find latest version from here

Basic Usage

Note

Make sure you have obtained authorization credentials before proceeding. You can get client id or secret key and generate access token like this.

Authorization

The following code snippet shows how to use the access token in auth object.

  • Access Token

    Make auth object using access token
JSONObject AuthKeys = new JSONObject();

try{
AuthKeys.put("auth_type","access_token");
AuthKeys.put("access_token","sp-accessToken");
} catch (JSONException e) {
e.printStackTrace();
}

Configuration

The Shufti Pro’s mobile SDKs can be configured on the basis of parameters provided in the config object. The details of parameters can be found here.

JSONObject Config=new JSONObject();

try{
Config.put("open_webview",false);
Config.put("asyncRequest",false);
Config.put("captureEnabled",false);
Config.put("dark_mode", false);
Config.put("video_kyc", false);
Config.put("show_requirement_page", false);
Config.put("base_url", "api.shuftipro.com");
Config.put("consent_age", 16);
} catch (JSONException e) {
e.printStackTrace();
}

Request Object

This object contains the service objects and their settings through which the merchant wants to verify end users. Complete details of service objects and their parameters can be found here.

JSONObject requestObject = new JSONObject();

try{
requestObject.put("reference", "12345678");
requestObject.put("country", "US");
requestObject.put("language", "EN");
requestObject.put("email", "");
requestObject.put("callback_url", "");
requestObject.put("verification_mode", "image_only");
requestObject.put("show_results", "1");

//Creating Face object
JSONObject faceObject = new JSONObject();
faceObject.put("proof", "");

requestObject.put("face", faceObject);

//Creating Document object
JSONObject documentObject = new JSONObject();

ArrayList<String> doc_supported_types = new ArrayList<String>();
doc_supported_types.add("passport");
doc_supported_types.add("id_card");
doc_supported_types.add("driving_license");
doc_supported_types.add("credit_or_debit_card");

documentObject.put("proof", "");
documentObject.put("additional_proof", "");

JSONObject docNameObject = new JSONObject();
docNameObject.put("first_name", "Johon");
docNameObject.put("middle_name", "Johsan");
docNameObject.put("last_name", "Livone");

documentObject.put("name", docNameObject);
documentObject.put("dob", "1980-11-12");
documentObject.put("document_number", "19901112");
documentObject.put("expiry_date", "1996-11-12");
documentObject.put("issue_date", "1990-11-12");
documentObject.put("backside_proof_required", "0");
documentObject.put("supported_types",new JSONArray(doc_supported_types));

requestObject.put("document", documentObject);


//Creating Document Two Object is exactly same as document object.
// Add document two to request object like
...
requestObject.put("document_two", documentTwoObject);

//Creating Address object
JSONObject addressObject = new JSONObject();

ArrayList<String> address_supported_types = new ArrayList<String>();
address_supported_types.add("id_card");
address_supported_types.add("passport");
address_supported_types.add("bank_statement");

JSONObject addressNameObject = new JSONObject();
addressNameObject.put("first_name", "Johon");
addressNameObject.put("middle_name", "Johsan");
addressNameObject.put("last_name", "Livone");

addressObject.put("name", addressNameObject);
addressObject.put("proof", "");
addressObject.put("full_address", "ST#2, 937-B, los angles.");
addressObject.put("supported_types",new JSONArray(address_supported_types));

requestObject.put("address", addressObject);

//Creating consent object
JSONObject consentObject = new JSONObject();

ArrayList<String> consent_supported_types = new ArrayList<String>();
consent_supported_types.add("handwritten");
consent_supported_types.add("printed");

consentObject.put("proof", "");
consentObject.put("text", "This is my consent. ");
consentObject.put("supported_types",new JSONArray(consent_supported_types));

requestObject.put("consent", consentObject);

//Creating phone object
requestObject.put("phone", "");

//Creating BGC object
requestObject.put("background_checks", "");

} catch (JSONException e) {
e.printStackTrace();
}

Initialisation

Shufti Pro’s mobile SDK can be initialised by using the given method and passing auth, config and request object as the parameters.

Shuftipro shuftipro = Shuftipro.getInstance();
shuftipro.shuftiproVerification(requestObject, AuthKeys, Config, MainActivity.this,
new ShuftiVerifyListener() {
@Override
public void verificationStatus(HashMap<String, String> responseSet) {

Log.e("Response",responseSet.toString());

}
});

Verification Types

Native Flow

In the native verification flow, the end-user interacts with the native mobile SDK. The native flow of verification tends to be much faster since the whole process depends on the device's processing power. All the proofs are taken against required services and then a request is made to the server
You can enable native flow by passing false for open_webview key in Config object.

Config.put("open_webview",false);

Hybrid Flow

The hybrid verification flow includes mobile verifications on a web view built on HTML 5 that will show the verification process to the end user. End-user provides the information in the online customer onboarding process. In hybrid flow, proofs are uploaded after every service, verification results are shown simultaneously in case of decline, and the user can retry the request.
You can enable hybrid flow by passing true for open_webview key in Config object.

Config.put("open_webview",true);
info

In both flows, Shufti Pro provides the facility to their customers to tailor the identity verification services according to their needs.

Callbacks

The SDK receive callbacks on termination, whether after the request completion or if the journey is left mid-way. The call backs are received in

 new ShuftiVerifyListener() {
@Override
public void verificationStatus(HashMap<String, String> responseSet)
{
Log.e("Response",responseSet.toString());
// Handle callback responses here
}
}

The complete list of callback events can be found here.

Callback Handling

All the callbacks can be handled inside the client’s calling activity. The responses and callback handling can be seen below.

On SDK Completion

if(responseSet.get("event").equalsIgnoreCase("verification.accepted")){
// Verification accepted callback
}
else if(responseSet.get("event").equalsIgnoreCase("verification.declined")){
// Verification declined callback
}

On SDK Unauthentication

if(responseSet.get("event").equalsIgnoreCase("request.unauthorized")){
// Verification unauthorized callback. This event occurs when the auth header or its parameters are invalid.
}

On SDK Error

if(responseSet.get("event").equalsIgnoreCase("permission.denied")){
// This callback is returned in case the permissions are declined by the end user.
}
else if(responseSet.get("event").equalsIgnoreCase("request.timeout")){
// This callback is returned in case request took too long and is timed out
}
else if(responseSet.get("event").equalsIgnoreCase("verification.cancelled")){
// This callback is returned when verification is cancelled midway by the end user
}
else if(responseSet.get("event").equalsIgnoreCase("request.invalid")){
// This callback is returned if the request parameters are incorrect.
}
else {
// Some error has been occured during the verification process
}

Customisation

ShuftiPro supports a set of customisation options that will influence the appearance of the mobile SDK.

Verification flow and UI

The complete verification journey is customisable. To remove the screen from verification flow, you need to provide that parameter to the SDK through request/config object. For instance;

Request Object

"country" : "GB" // providing a value to this parameter will not ask the end user to provide his country

"verification_mode" : "image_only" // "image_only" or "video_only" values will allow you to avoid mode selection at real-time

"allow_online" : "1" // 1 value will ask the user to capture real time proofs(image or video) depending upon verification mode

"allow_offline" : "1" // 1 value will ask the user to upload proofs(image or video) depending upon verification mode

"decline_on_single_step" : "1" // this parameter will work with onsite flow(open_webview : true). This will show continue the journey only if pervious step is successfully verified

"show_feedback_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will ask the user for its feedback at the end of verification

// Service Level Parameters

"supported_types" : [id_card] // providing a single value to this parameter will not ask the user for document type

"show_ocr_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will show the OCR form to the user


Config Object

"asyncRequest": true // passing true value to this parameter will not show result screen to the user and will just return the callback on request completion

"show_requirement_page": true // passing true value to this parameter will show requirement page of Shufti Pro verification.

"base_url": "api.shuftipro.com" // User can pass api.shuftipro.com or us-api.shuftipro.com

"consent_age": 16 // This parameter is use to set age in consent screen.

Colours

The colour of buttons and font can be customised by overriding the values of following variables in the project's color.xml file.

<color name="light_button_color">#2B6AD8</color>
<color name="light_text_color">#1D2C42</color>
<color name="dark_button_color">#FF7A77</color>
<color name="dark_text_color">#ffffff</color>
<color name="button_text_color">#FFFFFFFF</color>

Personalization

Shufti Pro provides its users the facility to personalize the text of SDK according to their individual requirements. The text of the SDK can be personalize by changing the values of corresponding variables given in this strings.xml file. The user just has to override the values of desired variables in their own project’s strings.xml file.

Dark mode

To apply and use dark theme/mode in SDK, initialise the SDK with provided parameters in the config object.

    Config.put("dark_mode",  true);

NFC verification

Near Field Communication (NFC) is a set of short-range wireless technologies. NFC allows sharing small payloads of data between an NFC tag and an NFC-supported device. NFC Chips found in modern passports and similar identity documents contain additional encrypted information about the owner. This information is very useful in verifying the originality of a document. NFC technology helps make the verification process simple, quicker and more secure. This also provides the user with contactless and input less verification. ShuftiPro's NFC verification feature detects MRZ from the document to authenticate NFC chips and retrieve data from it, so the authenticity and originality of the provided document could be verified.

Initialisation

Once the main SDK is integrated successfully, NFC SDK can be integrated easily by adding an additional dependency in app level build.gradle.

app/build.gradle
dependencies {
...
implementation 'com.github.shuftipro:NFC:2.2.6'
}

To check NFC supported documents and countries, please click here.

info

Nfc verification is allowed only on e-passports under document, document_two and address service only. The nfc service is not available in hybrid view for now.

Note

NFC dependency needs to be integrated with main SDK.

Revision History

DateSDK VersionsDescription
Mar 14, 20240.8.2Eliminated the exit dialog box from the result screen.
Dec 26, 20230.8.1Improved the consent screen of SDK.
Nov 28, 20230.8.0Improved the UI of result screen in case of personalization.
Nov 06, 20230.7.9Improvement
Improved the functionality of permissions in Android.
Oct 19, 20230.7.8Improvement
Added customisation of passport backside.
Oct 16, 20230.7.6Improvement
Fixed permission issue on Android 11 devices in hybrid flow.
Oct 11, 20230.7.5Changed
Changed the response formate of SDK callback
Improved the response of user cancelled and permission denied
Implemented WebP image formate.
Reduced the size of Shuftipro SDK.

Removed
Removed "response" object from callback.
Sep 06, 20230.7.4Improved NFC functionality.
Sep 06, 20230.7.3Add age option on consent screen.
Aug 15, 20230.7.2Improved auto capture and title of camera screen.
Aug 11, 20230.7.1Handled consent key.
Aug 04, 20230.7.0Improved UI of SDK and auto capture.
Jul 12, 20230.6.9Improved overlay area of auto capture.
Jul 03, 20230.6.8Improved quality of auto capture frames.
Jun 27, 20230.6.7Add requirement page and help section in SDK.
May 28, 20230.6.5Improved the logging of SDK
May 26, 20230.6.4Improved auto capture image resolution.
May 24, 20230.6.3Improved quality of PDF in upload case.
May 18, 20230.6.2Improved logging and handle manual review key
May 16, 20230.6.1Improved logging of mobile SDK.
May 15, 20230.6.0Added encryption and improved the logging system of the SDK.
May 09, 20230.5.9Improved the security of SDK
Apr 22, 20230.5.4Improved the Uploaded feature of SDK.
Apr 13, 20230.5.2Text allignment on upload screen improve.
Apr 06, 20230.5.0Improved the stepper of mobile SDK
Apr 05, 20230.4.9Add flip animation and improve request encryption
Mar 22, 20230.4.8Updated UI and proguard rules
Mar 16, 20230.4.7Countries list is updated
Mar 15, 20230.4.6Improved auto capture and UI updated for custom supported types
Mar 09, 20230.4.5Strings.xml file is updated to avoid accidental asset overriding
Mar 01, 20230.4.4Removed the Test-Ids feature and improve user experience.
Feb 28, 20230.4.3Improved assets management and reduce the size of SDK
Feb 27, 20230.4.2Improved the NFC functionality
Feb 22, 20230.4.1Add android 13 permission support in onsite flow
Feb 17, 20230.3.9SDK calling activity configuration improved on closing SDK the user's calling activity's configurations are restored
Feb 14, 20230.3.8Improved the overall performance of mobile SDK.
Feb 13, 20230.3.7Cloudfare timeout response handled.
Feb 10, 20230.3.6Updated gradle version from 6.5 to 7.5 in SDK.
Feb 9, 20230.3.4Improved null checks of mobiel SDK.
Feb 3, 20230.3.3Added new key "duplicate_face_match"
This checks if the face matches any pervious verification.
Feb 1, 20230.3.2MRZ scanning is improved**
MRZ is now being extracted from full captured image
Feb 1, 20230.3.1Improved the SDK screen size layout when the user device size is maximum.
Jan 31, 20230.2.9Improved the image quality of document service.
In document service show & submit full document image.
Jan 30, 20230.2.8Improved the security of Shufti Pro assets replacement
Jan 24, 20230.2.7Added video KYC service inside SDK in which users can verify identity through video calls with the Shufti Pro agent.
Jan 16, 20230.2.6Tap to focus feature is added to camera .
Jan 3, 20230.2.5Improved internet connectivity checks, SDK will now check for limited internet connections.
Dec 28, 20220.2.4Logging mechanism for failed nfc tries added
1. UI for nfc verification was improved
2. Animated instruction(gif) for NFC was improved
3. Data representation was improved
Dec 23, 20220.2.3Option to switch between visual and textual instructions is added.
Dec 17, 20220.2.2Android 13 do not require storage permission. So, the need of storage permission was removed for android 13.
Dec 15, 20220.2.1Improved the instructions for face verification.