Android SDK
1. Introduction
This project is developed by the FPT Smart Cloud Team to build a framework for electronic Know Your Customer (eKYC) functionality. The framework is designed to support the verification of four (04) types of Vietnamese identity documents: Identity Cards (both with and without NFC chips), Driving licences, and Passports.
App demo: FPT AI eKYC - Android SDK
2. Installation
- 
Copy
ekycsdk.aartoapp/libs - 
Implement necessary dependencies
 
    .....
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.concurrent:concurrent-futures-ktx:1.1.0'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation 'androidx.navigation:navigation-fragment:2.5.2'
    implementation 'androidx.navigation:navigation-ui:2.5.2'
    implementation 'androidx.fragment:fragment-ktx:1.x.x'
    def retrofit_version = "2.9.0"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    def camerax_version = "1.4.2"
    implementation "androidx.camera:camera-core:$camerax_version"
    implementation "androidx.camera:camera-camera2:$camerax_version"
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
    implementation "androidx.camera:camera-view:$camerax_version"
    implementation "androidx.camera:camera-video:$camerax_version"
    implementation "androidx.concurrent:concurrent-futures-ktx:1.1.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
    // OCR
    implementation 'com.google.guava:guava:31.1-android'
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    implementation "com.airbnb.android:lottie:3.5.0"
    
	implementation 'com.google.ai.edge.litert:litert-support:1.4.0'
    implementation 'com.google.ai.edge.litert:litert-metadata:1.4.0'
    //Choose 1 or 2
    //1. Model is statically linked to your app at build time. Model is available immediately.
    implementation 'com.google.mlkit:face-detection:16.1.7' 
    implementation 'com.google.mlkit:barcode-scanning:17.3.0'
    //2. Model is dynamically downloaded via Google Play Services. Might have to wait for model to download before first use.
    implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
    implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.1' 
    
    // if use NFC
    implementation 'org.jmrtd:jmrtd:0.7.35'
    implementation 'com.madgag.spongycastle:prov:1.58.0.0'
    implementation 'net.sf.scuba:scuba-sc-android:0.0.23'
    implementation 'edu.ucar:jj2000:5.2'
    implementation 'com.github.mhshams:jnbis:2.1.2'
    implementation 'com.google.android.gms:play-services-mlkit-text-recognition:19.0.1'
    //
    
3. Read data from ID card
- Start 
EkycSDK- API_KEY: key from EKYC.
 - UUID: unique string for ekyc session
 - DOCUMENT_TYPE: identity_card, driver_license, passport.
 - ENVIRONMENT (default is PROD): PROD, DEV, STAGING
 - COUNTRY (default = "vi"): Codes for the Representation of Names of Languages(ISO 639-1)
 - BASE_URL: Use only if using proxy (ex: https://domain/)
 
 
    val headers: MutableMap<String, String> = HashMap()
    headers["custom_header1"] = "value1"
    headers["custom_header2"] = "value2"
    fun getBuilder() {
      EkycSDK.Builder(requireActivity())
         .setUUID(UUID.randomUUID().toString())
         .setApiKey("")
         .setDocType(BaseConfig.DocumentType.IDENTITY_CARD.ordinal)
         // optional
         .setLang("vi")
         .setHeaders(headers)
         .setEnvironment(BaseConfig.EnvironmentType.STAGING.ordinal)
         .setBaseUrl("proxy")
         .addListener(object : EkycSDK.CompleteListener {
            override fun onSuccess(results: String?) {
               println("result onSuccess  result $results")
            }
            override fun onFailed(results: String?, errorMessage: String?) {
               println("result OCR failed result $results errMessage = $errorMessage")
            }
            override fun onTracking(message: String?) {
               println("result message $message")
   
            }
         })
       }
    //start sdk
    getBuilder().build()
- Start Document first (with liveness after)
 
    getBuilder().setBreakFlow(true)
    // after
    getBuilder().setSessionID("")//get sessionId from result at first step
- Start Document only
 
    getBuilder().setDocOnly(true)
- Start NFC only
 
    getBuilder().setNFCOnly(true) 
    or
    getBuilder().setNFCWithLive(true)
    // if you want to scan nfc without mrz, you can set: cardId date of birth, date of expride
    setCardId("025092000372")
    setCardDob("12/01/1992")
    setCardDoe("12/01/2032")
- Start Liveness only (face authentication)
 
    getBuilder().setLiveOnly(true)
- Customize layout (open .aar file in Android Studio)
 
- User can customize layout by override a layout into sdk res folder, keep file name, action id.
 - User can edit text, color by override a key (string,color) into sdk values folder
 
- You also need to add the following Proguard rules to your proguard-rules.pro file:
 
    -keep class com.fpt.fci.ekycfull.lib.innovatrics.records.** { *; }
    -keep class com.fpt.fci.ekycfull.domain.** { *; }
    -keep class com.fpt.fci.ekycfull.presentation.view.** { *; }
    -keep class com.fpt.fci.ekycfull.utils.Constant { *; }
    -keep class com.fpt.fci.ekycfull.EkycSDK$* {
        *;
    }
    -keep class com.squareup.** { *; }
    -allowaccessmodification
    -useuniqueclassmembernames
    -keeppackagenames com.fpt.fci.ekycfull**
    -keep class org.jmrtd.** { *; }
    -keep class net.sf.scuba.** {*;}
    -keep class org.bouncycastle.** {*;}
    -keep class org.spongycastle.** {*;}
    -keep class edu.ucar.** {*;}
    -dontwarn edu.ucar.**
    -dontwarn org.bouncycastle.**
    -dontwarn org.spongycastle.**
    
    -dontwarn org.jmrtd.**
    -dontwarn net.sf.scuba.**
    -ignorewarnings
    -keepattributes RuntimeVisibleAnnotations
    -keep class * extends androidx.navigation.Navigator
    -if interface * { @retrofit2.http.* public *** *(...); }
    -keep,allowoptimization,allowshrinking,allowobfuscation class <3>
    -keep class java.nio.ByteBuffer {public *;}