Android SDK (Deprecated)
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:
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 Sample (Java): Java-SDK
- Integration Sample (Kotlin): Kotlin-SDK
Integration
SDK Integration Guide
It’s always recommended to use the updated version
Step 1: Go to root-level setting.gradle in your project and add the following:
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
implementation 'com.github.shuftipro:ShuftiPro_SDK:$Latest-Version'
You can find latest version from here
Basic Usage
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
- Java
- Kotlin
JSONObject AuthKeys = new JSONObject();
try{
AuthKeys.put("auth_type","access_token");
AuthKeys.put("access_token","sp-accessToken");
} catch (JSONException e) {
e.printStackTrace();
}
val AuthKeys = JSONObject().apply {
put("auth_type", "access_token")
put("access_token", "sp-accessToken")
}
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.
- Java
- Kotlin
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();
}
val Config = JSONObject().apply{
put("open_webview", false) //pass true for verification through hybrid view
put("asyncRequest", false)
put("captureEnabled", false)
put("dark_mode", false)
put("video_kyc", false)
put("show_requirement_page", false)
put("base_url", "api.shuftipro.com")
put("consent_age", 16)
}
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.
- Java
- Kotlin
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");
requestObject.put("allow_warnings", "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();
}
val requestObject = JSONObject().apply {
put("reference", "12345678")
put("country", "US")
put("language", "EN")
put("email", "")
put("callback_url", "")
put("verification_mode", "image_only")
put("show_results", "1")
put("allow_warnings", "1")
}
//Creating Face object
val faceObject = JSONObject()
faceObject.put("proof", "")
requestObject.put("face", faceObject)
//Creating Document object
val documentObject = JSONObject().apply {
put("supported_types", JSONArray().apply {
put("id_card")
put("passport")
put("driving_license")
put("credit_or_debit_card")
})
put("proof", "")
put("additional_proof", "")
put("name", JSONObject().apply {
put("first_name", "Johon")
put("middle_name", "Johsan")
put("last_name", "Livone")
})
put("dob", "1980-11-12")
put("document_number", "19901112")
put("expiry_date", "1996-11-12")
put("issue_date", "1990-11-12")
put("backside_proof_required", "0")
}
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
val addressObject = JSONObject().apply {
put("supported_types", JSONArray().apply {
put("id_card")
put("passport")
put("bank_statement")
})
put("name", JSONObject().apply {
put("first_name", "Johon")
put("middle_name", "Johsan")
put("last_name", "Livone")
})
put("proof", "")
put("full_address", "ST#2, 937-B, los angles.")
}
requestObject.put("address", addressObject)
//Creating consent object
val consentObject = JSONObject().apply {
put("supported_types", JSONArray().apply {
put("handwritten")
put("printed")
})
put("proof", "")
put("text", "This is my consent. ")
}
requestObject.put("consent", consentObject)
//Creating phone object
requestObject.put("phone", "")
//Creating BGC object
requestObject.put("background_checks", "")
Initialisation
Shufti Pro’s mobile SDK can be initialised by using the given method and passing auth, config and request object as the parameters.
- Java
- Kotlin
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());
}
});
val shuftipro = Shuftipro.getInstance()
shuftipro.shuftiproVerification(requestObject, AuthKeys, Config, this@MainActivity) {
Toast.makeText(this@MainActivity, it.toString(), Toast.LENGTH_SHORT).show()
}
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.
- Java
- Kotlin
Config.put("open_webview",false);
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.
- Java
- Kotlin
Config.put("open_webview",true);
Config.put("open_webview",true)
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
- Java
- Kotlin
new ShuftiVerifyListener() {
@Override
public void verificationStatus(HashMap<String, String> responseSet)
{
Log.e("Response",responseSet.toString());
// Handle callback responses here
}
}
val shuftipro = Shuftipro.getInstance();
shuftipro.shuftiproVerification(requestObject, AuthKeys, Config, this@MainActivity,
object : ShuftiVerifyListener {
override fun verificationStatus(responseSet: Map<String, Any>) {
}
})
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
- Java
- Kotlin
if(responseSet.get("event").equalsIgnoreCase("verification.accepted")){
// Verification accepted callback
}
else if(responseSet.get("event").equalsIgnoreCase("verification.declined")){
// Verification declined callback
}
when (responseSet["event"])
{
"verification.accepted" -> Log.i("Response","accepted") // Verification accepted callback
"verification.declined" -> Log.i("Response","declined") // Verification declined callback
}
On SDK Unauthentication
- Java
- Kotlin
if(responseSet.get("event").equalsIgnoreCase("request.unauthorized")){
// Verification unauthorized callback. This event occurs when the auth header or its parameters are invalid.
}
if(it.get("event").equals("request.unauthorized")){
// Verification unauthorized callback. This event occurs when the auth header or its parameters are invalid.
}
On SDK Error
- Java
- Kotlin
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
}
when (responseSet["event"])
{
"permission.denied" -> Log.i("Response","permission denied") // This callback is returned in case the permissions are declined by the end user.
"request.timeout" -> Log.i("Response","timeout") // This callback is returned in case request took too long and is timed out
"verification.cancelled" -> Log.i("Response","cancelled") // This callback is returned when verification is cancelled midway by the end user
"request.invalid" -> Log.i("Response","invalid request") // This callback is returned if the request parameters are incorrect.
else -> Log.i("Response", "error") // 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
.
dependencies {
...
implementation 'com.github.shuftipro:NFC:2.2.6'
}
To check NFC supported documents and countries, please click here.
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.
NFC dependency needs to be integrated with main SDK.
Revision History
Date | SDK Versions | Description |
---|---|---|
Mar 14, 2024 | 0.8.2 | Eliminated the exit dialog box from the result screen. |
Dec 26, 2023 | 0.8.1 | Improved the consent screen of SDK. |
Nov 28, 2023 | 0.8.0 | Improved the UI of result screen in case of personalization. |
Nov 06, 2023 | 0.7.9 | Improvement Improved the functionality of permissions in Android. |
Oct 19, 2023 | 0.7.8 | Improvement Added customisation of passport backside. |
Oct 16, 2023 | 0.7.6 | Improvement Fixed permission issue on Android 11 devices in hybrid flow. |
Oct 11, 2023 | 0.7.5 | Changed 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, 2023 | 0.7.4 | Improved NFC functionality. |
Sep 06, 2023 | 0.7.3 | Add age option on consent screen. |
Aug 15, 2023 | 0.7.2 | Improved auto capture and title of camera screen. |
Aug 11, 2023 | 0.7.1 | Handled consent key. |
Aug 04, 2023 | 0.7.0 | Improved UI of SDK and auto capture. |
Jul 12, 2023 | 0.6.9 | Improved overlay area of auto capture. |
Jul 03, 2023 | 0.6.8 | Improved quality of auto capture frames. |
Jun 27, 2023 | 0.6.7 | Add requirement page and help section in SDK. |
May 28, 2023 | 0.6.5 | Improved the logging of SDK |
May 26, 2023 | 0.6.4 | Improved auto capture image resolution. |
May 24, 2023 | 0.6.3 | Improved quality of PDF in upload case. |
May 18, 2023 | 0.6.2 | Improved logging and handle manual review key |
May 16, 2023 | 0.6.1 | Improved logging of mobile SDK. |
May 15, 2023 | 0.6.0 | Added encryption and improved the logging system of the SDK. |
May 09, 2023 | 0.5.9 | Improved the security of SDK |
Apr 22, 2023 | 0.5.4 | Improved the Uploaded feature of SDK. |
Apr 13, 2023 | 0.5.2 | Text allignment on upload screen improve. |
Apr 06, 2023 | 0.5.0 | Improved the stepper of mobile SDK |
Apr 05, 2023 | 0.4.9 | Add flip animation and improve request encryption |
Mar 22, 2023 | 0.4.8 | Updated UI and proguard rules |
Mar 16, 2023 | 0.4.7 | Countries list is updated |
Mar 15, 2023 | 0.4.6 | Improved auto capture and UI updated for custom supported types |
Mar 09, 2023 | 0.4.5 | Strings.xml file is updated to avoid accidental asset overriding |
Mar 01, 2023 | 0.4.4 | Removed the Test-Ids feature and improve user experience. |
Feb 28, 2023 | 0.4.3 | Improved assets management and reduce the size of SDK |
Feb 27, 2023 | 0.4.2 | Improved the NFC functionality |
Feb 22, 2023 | 0.4.1 | Add android 13 permission support in onsite flow |
Feb 17, 2023 | 0.3.9 | SDK calling activity configuration improved on closing SDK the user's calling activity's configurations are restored |
Feb 14, 2023 | 0.3.8 | Improved the overall performance of mobile SDK. |
Feb 13, 2023 | 0.3.7 | Cloudfare timeout response handled. |
Feb 10, 2023 | 0.3.6 | Updated gradle version from 6.5 to 7.5 in SDK. |
Feb 9, 2023 | 0.3.4 | Improved null checks of mobiel SDK. |
Feb 3, 2023 | 0.3.3 | Added new key "duplicate_face_match" This checks if the face matches any pervious verification. |
Feb 1, 2023 | 0.3.2 | MRZ scanning is improved** MRZ is now being extracted from full captured image |
Feb 1, 2023 | 0.3.1 | Improved the SDK screen size layout when the user device size is maximum. |
Jan 31, 2023 | 0.2.9 | Improved the image quality of document service. In document service show & submit full document image. |
Jan 30, 2023 | 0.2.8 | Improved the security of Shufti Pro assets replacement |
Jan 24, 2023 | 0.2.7 | Added video KYC service inside SDK in which users can verify identity through video calls with the Shufti Pro agent. |
Jan 16, 2023 | 0.2.6 | Tap to focus feature is added to camera . |
Jan 3, 2023 | 0.2.5 | Improved internet connectivity checks, SDK will now check for limited internet connections. |
Dec 28, 2022 | 0.2.4 | Logging 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, 2022 | 0.2.3 | Option to switch between visual and textual instructions is added. |
Dec 17, 2022 | 0.2.2 | Android 13 do not require storage permission. So, the need of storage permission was removed for android 13. |
Dec 15, 2022 | 0.2.1 | Improved the instructions for face verification. |