### Start Callback Parameters Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Details the parameters for the start callback, including the resulting bitmap and success status. For NFC, an additional exception parameter is provided. ```java //The method in front of the start() method may vary according to the document as follows. Amani.sharedInstance().ScanNFC()/IDCapture()/Selfie().start(tag, getApplicationContext(), "BIRTH DATE" , "EXPIRE DATE" , "DOCUMENT NUMBER", (bitmap, isSuccess) -> { }) // bitmap (type: Bitmap) : If this parameter is not "null", it means that the result of the previous function was successful. // isSuccess (type: boolean) : Indicates whether the operation was successful or unsuccessful. ``` -------------------------------- ### Start Auto Selfie Capture Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Demonstrates how to initiate the Auto Selfie Capture process. It involves creating an `ASCBuilder` with various UI and timing configurations, and then calling the `start` method with document type, the builder, a FrameLayout, and a callback for the capture result. ```kotlin // Preparing AutoSelfieCaptureBuilder for User Interface val ascBuilder = ASCBuilder( R.color.color_black, // Text color of message 20, // Text size of message R.color.any_color, // Text color of counter animation. true, // Counter visibility as boo 100, // Counter text size (It should be proportional to the screen size. As a proper usage: getScreenHeight()/10) 20, // Manual capture button time out as second. "Be sure to be close enough", // Message texts "Face not found", // Message texts "Hold stable, while taking photo", // Message texts "Failed, process will restart in 3 seconds", // Message texts R.color.any_color2, // Oval view color R.color.any_color3) // Success animate color //Getting the view of related Fragment Amani.sharedInstance() .AutoSelfieCapture() .onException(onException = object : ExceptionCallBack{ override fun onException(exception: Exception) { /** * Triggering this block indicates that there is a non-fatal error caught in the * fragment that will not crash your application. * * In such cases, you can log the error to your crash service to report it to * the Amani Mobile team later. * * Then, you can send a message to the user informing them of the error and * remove the fragment from the back stack with your fragment manager. */ } }) .start( docType = "type_of_document example: XXX_SE_0", ascBuilder = ascBuilder, frameLayout = frameLayout, object : IFragmentCallBack { override fun cb(bitmap: Bitmap?, manualButtonActivated: Boolean?, file: File?) { //If bitmap is not null it 's succeed } } ) //Navigating the desired Fragment view fragment?.let { replaceFragmentWithBackStack(R.id.frame_pose_estimation, it) } ``` -------------------------------- ### Start Document Capture and Upload Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initiates the generic document capture process using the Amani SDK. It starts a document fragment with specified type and builder configurations, and handles the upload of captured documents based on the success of the capture. ```java //Calling Generic Document Fragment and Uploading Documents (due to lambda function result) Fragment docFragment = Amani.sharedInstance() .Document() .start("DOC_TYPE",docBuilder, frameLayout,(docList,isSucess)->{ if (isSuccess) { //Uploading Generic Documents that taken from camera Amani.sharedInstance().Document().upload(this,"DOC_TYPE",(isSuccess, result, errors) -> { if (isSuccess) Toast.makeText(this,"Generic Document Upload is Success", Toast.LENGTH_LONG).show(); else Toast.makeText(this,"Generic Document Upload is Not Success", Toast.LENGTH_SHORT).show(); }); } }); yourFragmentMethod(docFragment); ``` -------------------------------- ### Initialize Video Call and Start Call Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK for video calls and starts a video call. The call is initiated in the Chrome application. Handles cases where Chrome might not be installed. ```java Amani.sharedInstance().initAmani(MainActivity.this,"ID NUMBER","TOKEN","tr",(isSuccess, errorCode) -> { if (isSuccess){ //Login successful try { startActivity(Amani.sharedInstance().VideoCall() .geoLocation(true) .language("tr") .returnURL("SERVER_URL") .start()) } catch (ActivityNotFoundException e) { Log.e("TAG", "Chrome not found: "); // You can set any alert message to download chrome } } }); ``` -------------------------------- ### Start Manual Selfie Capture Fragment Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initiates the manual selfie capture process by returning a Fragment. It includes error handling via `onException` and a callback for successful capture via `cb`. ```kotlin val fragment = Amani.sharedInstance() .Selfie() .onException(onException = object : ExceptionCallBack{ override fun onException(exception: Exception) { /** * Triggering this block indicates that there is a non-fatal error caught in the * fragment that will not crash your application. * * In such cases, you can log the error to your crash service to report it to * the Amani Mobile team later. * * Then, you can send a message to the user informing them of the error and * remove the fragment from the back stack with your fragment manager. */ } }) .start( "type_of_document example: XXX_SE_0", object : IFragmentCallBack{ override fun cb(bitmap: Bitmap?, manualButtonActivated: Boolean?, file: File?) { //If bitmap is not null it means Selfie is taken successfuully } } ) //Navigating the desired Fragment view fragment?.let { replaceFragmentWithBackStack(R.id.frame_pose_estimation, it) } ``` -------------------------------- ### AutoSelfieCapture API Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Provides an overview of the AutoSelfieCapture module's methods, including `start` for initiating the capture process and `upload` for sending the captured data. It also details the `ASCBuilder` for UI configuration and `onException` for handling errors. ```APIDOC AutoSelfieCapture: start(docType: String, ascBuilder: ASCBuilder, frameLayout: FrameLayout, callback: IFragmentCallBack): Initiates the automatic selfie capture process. Parameters: docType: Type of the document for capture (e.g., "XXX_SE_0"). ascBuilder: Configuration object for the UI and behavior of the capture. frameLayout: The FrameLayout where the capture fragment will be displayed. callback: An interface to receive the capture result (Bitmap, manual button status, file). upload(context: Context, callback: UploadCallBack): Uploads the captured selfie data. Parameters: context: The Android context. callback: A callback to handle the upload result. Warning: Must be called after a successful capture. onException(onException: ExceptionCallBack): Sets a callback to handle non-fatal exceptions during the capture process. Parameters: onException: An interface to receive and handle exceptions. ASCBuilder: __init__(textColor: Int, textSize: Int, counterColor: Int, counterVisibility: Boolean, counterTextSize: Int, manualCaptureTimeout: Int, message1: String, message2: String, message3: String, message4: String, ovalViewColor: Int, successAnimateColor: Int): Constructor for configuring the AutoSelfieCapture UI elements and behavior. Parameters: textColor: Color for message text. textSize: Size for message text. counterColor: Color for the counter animation text. counterVisibility: Boolean to control counter visibility. counterTextSize: Text size for the counter, ideally proportional to screen height. manualCaptureTimeout: Timeout in seconds for the manual capture button. message1: Text message for initial prompt. message2: Text message when face is not found. message3: Text message while holding stable. message4: Text message on failure before restart. ovalViewColor: Color for the oval view indicator. successAnimateColor: Color for the success animation. ExceptionCallBack: onException(exception: Exception): Callback method to handle exceptions. IFragmentCallBack: cb(bitmap: Bitmap?, manualButtonActivated: Boolean?, file: File?): Callback method for capture results. Parameters: bitmap: The captured selfie image as a Bitmap (null if capture failed). manualButtonActivated: Boolean indicating if the manual button was activated. file: The captured selfie image as a File (null if capture failed). ``` -------------------------------- ### Android SDK Callback Example Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet demonstrates a typical callback pattern used in Android development, likely for asynchronous operations. It includes placeholders for success and error handling logic. ```java }, onError = { //Error handling here } ) ``` -------------------------------- ### Start ID Capture and Handle Results Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initiates the ID Capture process, returning a Fragment to be displayed. It includes an exception handler for non-fatal errors and a callback for when a document is captured, providing the captured bitmap and file. ```kotlin val fragment: Fragment? = Amani.sharedInstance() .IDCapture() .onException(onException = object : ExceptionCallBack{ override fun onException(exception: Exception) { /** * Triggering this block indicates that there is a non-fatal error caught in the * fragment that will not crash your application. * * In such cases, you can log the error to your crash service to report it to * the Amani Mobile team later. * * Then, you can send a message to the user informing them of the error and * remove the fragment from the back stack with your fragment manager. */ } }) .start( this, //Context of the Application frameLayout, //FrameLayout where the current IDCapture fragment will be fit in docType, // Type of the document false // Boolean value for frontSide/backSide, set true for frontSide, set false for backSide ) { bitmap: Bitmap?, b: Boolean?, file: File? -> bitmap?.let { //Current document is captured, upload method of current module can be triggered. } } replaceFragmentWithBackStack(R.id.id_frame_layout, fragment!!) ``` -------------------------------- ### Start Digital Signature Capture Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initiates the digital signature capture process. It returns a fragment and takes the number of signatures required as input. A callback handles the captured signature bitmap and the count of signatures. ```java int NUMBER_OF_SIGNATURE_WILL_BE_TAKEN = 1; Amani.sharedInstance().Signature().start(this, NUMBER_OF_SIGNATURE_WILL_BE_TAKEN, (bitmap, countOfSignature) -> { if (bitmap != null) { if (NUMBER_OF_SIGNATURE_WILL_BE_TAKEN == countOfSignature) { Amani.sharedInstance().Signature().upload((isSuccess, result, errors) -> { if (isSuccess) { Log.d(TAG, "Signature is uploaded"); } if (result != null) { if (result.equals("OK")) { Log.d(TAG, "Pending Review"); } } if (errors != null) { if (errors.get(0) != null) { Log.d(TAG, " Error" + errors.get(0)); } } }); } } }); ``` -------------------------------- ### Start NFC Scanning Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configures the activity to enable foreground NFC dispatch. This involves setting up a PendingIntent and defining filters for NFC technologies. ```java @Override protected void onResume() { super.onResume(); ScanNFCAdapter adapter = ScanNFCAdapter.getDefaultAdapter(this); if (adapter != null) { Intent intent = new Intent(getApplicationContext(), this.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); String[][] filter = new String[][]{new String[]{"android.ScanNFC.tech.IsoDep"}}; adapter.enableForegroundDispatch(this, pendingIntent, null, filter);} } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); tag = intent.getExtras().getParcelable(ScanNFCAdapter.EXTRA_TAG); Amani.sharedInstance().ScanNFC().start(tag, getApplicationContext(), "BIRTH DATE" , "EXPIRE DATE" , "DOCUMENT NUMBER", (bitmap, isSuccess, exception) -> {if (isSuccess) {//ScanNFC Scan is success! }); } ``` -------------------------------- ### NFC Exception Handling Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Illustrates how to access the exception parameter in the NFC start callback to retrieve error messages. ```java ...NFC().start("firstParam","secondParam,\"thirdParam",(bitmap, isSuccess, exception)) ``` -------------------------------- ### Get Customer Detail Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Retrieves the latest updated details for a created customer. It uses an observer pattern to deliver the customer details or any errors. ```java Amani.sharedInstance() .CustomerDetail() .getCustomerDetail (new CustomerDetailObserver() { @Override public void result(@Nullable ResCustomerDetail customerDetail, @Nullable Throwable throwable) { //customerDetail is fetched if there is no throwable } }); ``` -------------------------------- ### Get MRZ Data for NFC Scanning Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Retrieves the Machine Readable Zone (MRZ) data, which is necessary for NFC scanning. This method is optional and is only required if the NFC data group is not already available. The extracted data can be used in the ScanNFC.start() function. ```kotlin Amani.sharedInstance() .IDCapture() .getMRZ( type = "type_of_document", onComplete = { mrz -> /* Mrz model will be fetched in this section. This data model contains required values for scanning NFC. For scanning NFC with the response of Mrz request, the following values can be used in ScanNFC.start(_,_,_) function -> mrz.mrzBirthDate, mrz.mrzExpiryDate, mrz.mrzDocumentNumber */ } ) ``` -------------------------------- ### Initialize Amani SDK with Upload Source Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK with server, shared secret, and specifies an initial `UploadSource` for uploads. ```kotlin Amani.init(this, "SERVER", "SHARED_SECRET", UploadSource.KYC) ``` -------------------------------- ### Amani SDK API Documentation Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Provides an overview of the Amani SDK's API structure, including initialization and biometric login modules. ```APIDOC Amani: sharedInstance(): Amani Returns the singleton instance of the Amani SDK. initAmani(context: Context, idNumber: String, email: String, password: String, language: String, callback: (isSuccess: Boolean, errorCode: Int?) -> Unit) Initializes the Amani SDK. Parameters: context: The application context. idNumber: The identification number for initialization. email: The email address for initialization. password: The password for initialization. language: The language code for the SDK (e.g., "tr"). callback: A callback function that receives a boolean indicating success and an optional error code. BioLogin(): BioLogin Provides access to the Biometric Login functionalities. BioLogin: ManualSelfieCapture(): ManualSelfieCaptureBuilder Returns a builder for configuring the manual selfie capture UI. ManualSelfieCaptureBuilder: userInterfaceColors(appFontColor: Int, manualButtonColor: Int, ovalViewColor: Int, appBackgroundColor: Int): ManualSelfieCaptureBuilder Sets custom colors for the user interface elements. Parameters: appFontColor: Color resource for application fonts. manualButtonColor: Color resource for the manual capture button. ovalViewColor: Color resource for the oval view. appBackgroundColor: Color resource for the application background. userInterfaceTexts(instructionText: String): ManualSelfieCaptureBuilder Sets custom text for user instructions. Parameters: instructionText: The text to display to the user. observer(observer: ManualSelfieCaptureObserver): ManualSelfieCaptureBuilder Sets an observer to receive selfie capture results. build(): Fragment? Builds and returns the Fragment for manual selfie capture. ManualSelfieCaptureObserver: cb(bitmap: Bitmap?) Callback method invoked when a selfie is captured. Parameters: bitmap: The captured selfie image as a Bitmap, or null if capture failed. ``` -------------------------------- ### Prepare DocumentBuilder for UI and Logic Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Prepares a DocumentBuilder instance to configure the user interface and logic for document capture. This includes setting text labels, colors, and the number of documents to be captured. ```java DocBuilder docBuilder = new DocBuilder("Tekrar Dene", // Text label "Onayla", // Text label R.color.color_blue, // Text color R.color.color_blue, // Text color R.color.white, // Button color 2); // Indicates the number of documents. ``` -------------------------------- ### Set Upload Source using String Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Dynamically sets the `UploadSource` for the Amani SDK using its string equivalent. ```kotlin Amani.sharedInstance().setUploadSource("Kyc") ``` -------------------------------- ### Initialize Amani SDK Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK. This method must be called at least once before other Amani methods are used within the same activity. It requires server details and a shared secret for security. ```java Amani.init(MainActivity.this, "SERVER", "SHARED_SECRET"); // SHARED_SECRET is a Key required to sign Signature for security layer. ``` -------------------------------- ### Initialize Amani SDK Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK. This method must be called at least once before other methods in the same activity. If used in a different activity, it may need to be called twice. ```java Amani.init(MainActivity.this, "SERVER", "SHARED_SECRET"); // SHARED_SECRET is a Key required to sign Signature for security layer. ``` -------------------------------- ### Initialize Amani SDK Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK. This function should be called once during the application's lifecycle. Subsequent calls are only necessary if the application's lifecycle ends and restarts. The success of this initialization determines the availability of other SDK modules. ```kotlin Amani.sharedInstance() .initAmani( this, "ID_NUMBER", "EMAIL", "PASSWORD", "LANGUAGE e.g. tr" ) { isSuccess: Boolean, errorCode: Int? -> if (isSuccess) { //The request is successful, all other modules are ready to use. } else { //The request failed, due to error : $errorCode, other modules cannot //Other modules cannot be used until the request is successful. } } ``` -------------------------------- ### Configure Project-Level Maven Repository Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Steps to add the Amani SDK's Maven repository to your project's `build.gradle` file to resolve SDK dependencies. ```groovy allprojects { repositories { google() jcenter() maven { url "https://jfrog.amani.ai/artifactory/amani-sdk" } } } ``` -------------------------------- ### Initialize Amani SDK (Server and Shared Secret) Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK with the server endpoint and a shared secret for secure network requests. ```kotlin Amani.init(this, "SERVER", "SHARED_SECRET") ``` -------------------------------- ### Initialize Amani SDK (Server Only) Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Initializes the Amani SDK with the server endpoint. The `sharedSecret` is optional and affects request security. ```kotlin Amani.init(this, "SERVER") ``` -------------------------------- ### Add Amani SDK Dependency Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Instructions for adding the Amani AI SDK dependency to your Android module's `build.gradle` file. ```groovy implementation 'ai.amani.android:AmaniAi:2.6.5' ``` -------------------------------- ### Set Upload Source using Enum Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Dynamically sets the `UploadSource` for the Amani SDK using the `UploadSource` enum. ```kotlin Amani.sharedInstance().setUploadSource(UploadSource.KYC) ``` -------------------------------- ### Initialize and Configure Selfie Pose Estimation Fragment Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This Kotlin code demonstrates how to create a custom Selfie Pose Estimation fragment. It shows how to set the number of requested poses, animation duration, observer, and customize UI elements such as colors, texts, drawables, and visibilities. ```kotlin val fragment = Amani.sharedInstance().SelfiePoseEstimation() .Builder() .requestedPoseNumber(1) .ovalViewAnimationDurationMilSec(500) .observe(observer) .userInterfaceColors( appFontColor = R.color.your_color, ovalViewStartColor = R.color.your_color, ovalViewSuccessColor = R.color.your_color, ovalViewErrorColor = R.color.your_color, alertFontTitleColor = R.color.your_color, alertFontDescriptionColor = R.color.your_color, alertFontTryAgainColor = R.color.your_color, alertBackgroundColor = R.color.your_color ) .userInterfaceTexts( faceNotInside = "Face is not inside", faceNotStraight = "Face is not straight", faceTooFar = "Face is too far", holdPhoneVertically = "Hold phone as vertical", alertTitle = "Verification Failed", alertDescription = "Verification is failed, please try again.", alertTryAgain = "Try again", turnDown = "Turn your head down", turnLeft = "Turn your head left", turnRight = "Turn your head right", turnUp = "Turn your head up", faceStraight = "Look as straight position to screen" ) .userInterfaceDrawables( mainGuideStraight = R.drawable.your_drawable, mainGuideUp = R.drawable.your_drawable, mainGuideRight = R.drawable.your_drawable, mainGuideLeft = R.drawable.your_drawable, mainGuideDown = R.drawable.your_drawable, secondaryGuideUp = R.drawable.your_drawable, secondaryGuideRight = R.drawable.your_drawable, secondaryGuideDown = R.drawable.your_drawable, secondaryGuideLeft = R.drawable.your_drawable ) .userInterfaceVisibilities( mainGuideVisibility = true ``` -------------------------------- ### Pose Estimation Observer Callback Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet demonstrates how to implement the PoseEstimationObserver to handle the results of pose estimation. It includes callbacks for successful estimation, where an upload function can be triggered, and for failure scenarios. ```kotlin object : PoseEstimationObserver{ override fun onSuccess(bitmap: Bitmap?) { if (bitmap != null) { //Selfie data is taken, upload method can be triggered now to check result of BIOLogin. uploadSelfie() } } override fun onFailure(reason: OnFailurePoseEstimation, currentAttempt: Int) { //Pose on failure, poseNumber : $currentAttempt } override fun onError(error: Error) { //On general error } } ``` -------------------------------- ### Manual Selfie Capture UI Configuration Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configures the User Interface for manual selfie capture, allowing customization of colors, texts, and handling of captured bitmaps. ```kotlin //Manual Selfie Capture User interface configuration val fragment: Fragment? = Amani.sharedInstance() .BioLogin() .ManualSelfieCapture() .userInterfaceColors( appFontColor = R.color.white, manualButtonColor = R.color.white, ovalViewColor = R.color.white, appBackgroundColor = R.color.white ) .userInterfaceTexts( "PLease be sure your face is inside the area!" ) .observer(object : ManualSelfieCaptureObserver { override fun cb(bitmap: Bitmap?) { if (bitmap != null) { //Selfie data is taken, upload method can be triggered now to check result of BIOLogin. uploadSelfie() } } }) .build() //Navigating the fragment with null check fragment?.let { replaceFragmentWithBackStack(R.id.frame_pose_estimation, it) } ``` -------------------------------- ### Compile Options Configuration Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configures the Java source and target compatibility for the Android project to version 17. This ensures compatibility with modern Java features and libraries. ```groovy compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } ``` -------------------------------- ### ID Capture API Reference Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Provides an overview of the ID Capture module's methods, including their parameters, return types, and usage notes. ```APIDOC IDCapture Module: setManualCropTimeOut(timeoutSeconds: Int): - Sets the manual crop timeout for ID capture. - Default value: 30 seconds. start(context: Context, frameLayout: FrameLayout, docType: String, isFrontSide: Boolean, onException: ExceptionCallBack, onCapture: (Bitmap?, Boolean?, File?) -> Unit): - Starts the ID capture process. - Returns a Fragment for displaying the capture UI. - Parameters: - context: The application or activity context. - frameLayout: The FrameLayout to host the ID capture fragment. - docType: The type of document to capture. - isFrontSide: Boolean indicating if capturing the front side (true) or back side (false). - onException: Callback for handling non-fatal exceptions during capture. - onCapture: Callback triggered when a document is captured, providing bitmap, success status, and file. upload(context: Context, docType: String, callBack: IUploadCallBack): - Uploads captured ID data for verification. - Requires both front and back sides to be captured prior to calling. - Parameters: - context: The application or activity context. - docType: The type of the document being uploaded. - callBack: Callback for upload status (success, result, errors). getMRZ(type: String, onComplete: (MrzData?) -> Unit): - Fetches MRZ data for NFC scanning. - Optional method, used when NFC data is not readily available. - Parameters: - type: The type of document. - onComplete: Callback that receives the MrzData object containing details like mrzBirthDate, mrzExpiryDate, mrzDocumentNumber. ``` -------------------------------- ### ProGuard Rules for Amani SDK Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Essential ProGuard rules to ensure the Amani SDK functions correctly within your Android application, preventing issues with obfuscation and warnings. ```groovy -keep class ai.** {*;} -dontwarn ai.** -keep class datamanager.** {*;} -dontwarn datamanager.** -keep class networkmanager.** {*;} -dontwarn networkmanager.** -keep class org.jmrtd.** {*;} -keep class net.sf.scuba.** {*;} -keep class org.bouncycastle.** {*;} -keep class org.spongycastle.** {*;} -keep class org.ejbca.** {*;} -dontwarn org.ejbca.** -dontwarn org.bouncycastle.** -dontwarn org.spongycastle.** -dontwarn org.jmrtd.** -dontwarn net.sf.scuba.** -keep class org.tensorflow.lite**{ *; } -dontwarn org.tensorflow.lite.** -keep class org.tensorflow.lite.support**{ *; } -dontwarn org.tensorflow.lite.support** -dontwarn org.conscrypt.Conscrypt$Version -dontwarn org.conscrypt.Conscrypt -dontwarn org.conscrypt.ConscryptHostnameVerifier -dontwarn org.openjsse.javax.net.ssl.SSLParameters -dontwarn org.openjsse.javax.net.ssl.SSLSocket -dontwarn org.openjsse.net.ssl.OpenJSSE ``` -------------------------------- ### Enable DataBinding in Android Module Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configuration to enable the DataBinding feature within your Android module's `build.gradle` file. ```groovy dataBinding { enabled true } ``` -------------------------------- ### Upload Callback Parameters Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Details the parameters for the upload callback, including success status, result message, and error details. ```java //The method in front of the upload() method may vary according to the document as follows. Amani.sharedInstance().ScanNFC()/IDCapture()/Selfie().upload(this,"DOCUMENT TYPE", (uploadNFCSuccess, resultNFC, errors) -> { } ); // uploadNFCSuccess (type: boolean): Indicates that the upload was successful/failed as true/false. // resultNFC (type: String): The string of the message returned from the service after the upload process is completed. The cases where this message returns "OK" are returned when the service accepts this document. // errors (type: ArrayList): It contains errorMessages, errorCodes if exists. ``` -------------------------------- ### Update Customer Information Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Records basic customer information and prepares it for upload. The setInfo() function must be called before the upload() function. ```java Amani.sharedInstance() .CustomerInfo() .setInfo( "Mobile Developer", "İstanbul", "Maslak", "Maslak Mah. "); ``` -------------------------------- ### Amani SDK Selfie Upload and Callback Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet details the process of uploading selfie data using the Amani SDK. It includes the necessary parameters such as document type, token, and customer ID, and defines a callback to handle the upload result, indicating success or failure. ```kotlin Amani.sharedInstance() .BioLogin() .upload( docType = "type_of_document example: {XXX_SE_0}", token = TOKEN, customerID = 9999, //Customer ID as Integer object : BioLoginUploadCallBack { override fun cb(result: Boolean?, errors: Errors?) { //Result must be TRUE for Success } }) ``` -------------------------------- ### Gradle Properties Configuration Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Specifies essential Gradle properties for the Android project, including disabling R8 full mode, enabling AndroidX, and enabling Jetifier. These settings are crucial for proper library compatibility and build optimization. ```properties android.enableR8.fullMode=false android.useAndroidX=true android.enableJetifier=true ``` -------------------------------- ### Configure Selfie Pose Estimation Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configures the Selfie Pose Estimation module with the number of poses, UI customizations (colors, texts, drawables), and animation durations. Requires 'tflite' aaptOption for compilation. ```kotlin val fragment: Fragment? = Amani.sharedInstance() .BioLogin() .PoseEstimation() .requestedPoseNumber(1) .ovalViewAnimationDurationMilSec(12000) .userInterfaceColors( appFontColor = R.color.your_color, ovalViewStartColor = R.color.your_color, ovalViewSuccessColor = R.color.your_color, ovalViewErrorColor = R.color.your_color, alertFontTitleColor = R.color.your_color, alertFontDescriptionColor = R.color.your_color, alertFontTryAgainColor = R.color.your_color, alertBackgroundColor = R.color.your_color ) .userInterfaceTexts( faceNotInside = "Face is not inside", faceNotStraight = "Face is not straight", faceIsTooFar = "Face is too far", holdPhoneVertically = "Hold phone as vertical", alertTitle = "Verification Failed", alertDescription = "Verification is failed, please try again.", alertTryAgain = "Try again", turnDown = "Turn your head down", turnLeft = "Turn your head left", turnRight = "Turn your head right", turnUp = "Turn your head up", faceStraight = "Look as straight position to screen" ) .userInterfaceDrawables( mainGuideStraight = R.drawable.your_drawable, mainGuideUp = R.drawable.your_drawable, mainGuideRight = R.drawable.your_drawable, mainGuideLeft = R.drawable.your_drawable, mainGuideDown = R.drawable.your_drawable, ``` -------------------------------- ### Amani SDK BioLogin Methods Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Provides an overview of the BioLogin functionality within the Amani SDK. It outlines the `upload` method, its parameters, and the expected callback structure for processing the results of the biometric login process. ```APIDOC BioLogin: upload(docType: String, token: String, customerID: Integer, callBack: BioLoginUploadCallBack) Description: Uploads selfie data for biometric verification. Parameters: - docType (String): The type of document being verified (e.g., "XXX_SE_0"). - token (String): Authentication token for the upload request. - customerID (Integer): The unique identifier for the customer. - callBack (BioLoginUploadCallBack): An interface to handle the upload response. CallBack BioLoginUploadCallBack: cb(result: Boolean?, errors: Errors?) Description: Callback method to receive the result of the upload. Parameters: - result (Boolean?): True if the upload and verification were successful, null otherwise. - errors (Errors?): An object containing error details if the upload failed. Usage Warning: The upload method must be called only after a successful completion of a BIOLogin module (ManualSelfieCapture, AutoSelfieCapture, SelfiePoseEstimation). Calling it otherwise will result in an Error() object. ``` -------------------------------- ### General SDK Exception Codes Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Lists general exception codes for the SDK, including connectivity issues, general connection errors, configuration errors, and HTTP response exceptions. ```APIDOC General SDK Exceptions: Exception Code: 10500 - Case: No Connectivity Exception Exception Code: 10505 - Case: General Connection Error Exception Code: 10506 - Case: AppConfig Error Exception Code: -HttpErrorCodes- - Case: Http Response Exception ``` -------------------------------- ### Upload Customer Information Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Uploads the recorded customer information. It provides a callback to handle the upload status, result, and any errors. ```java Amani.sharedInstance() .CustomerInfo() .upload((isSuccess, result, errors) -> { if (isSuccess) // Uploading CustomerInfo is successfull. if (result.equals("OK")) // Pending review. if (errors != null) if (errors.get(0) != null){ // There is an error. } }); ``` -------------------------------- ### Observe Pose Estimation Events Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This code defines an observer for PoseEstimation events. It includes methods for handling successful estimations (uploading a selfie), failures with attempt counts, and general errors. ```kotlin private val observable: PoseEstimationObserver = object : PoseEstimationObserver { override fun onSuccess(bitmap: Bitmap?) { bitmap?.let { Log.i(TAG, "Verification is success") uploadSelfie() }?: run { Log.e(TAG, "Verification is not success") } } override fun onFailure(reason: OnFailurePoseEstimation, currentAttempt: Int) { Log.d(TAG, "onFailure: $currentAttempt") } override fun onError(error: Error) { Log.e(TAG, "onError: $error" ) } } ``` -------------------------------- ### Configure Auto Selfie Capture UI Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Configures the User Interface for Auto Selfie Capture, allowing customization of timeout, colors, texts, and observer for selfie capture results. It also includes navigation logic for the captured selfie fragment. ```kotlin val fragment = Amani.sharedInstance() .BioLogin() .AutoSelfieCapture() .timeOutManualButton(30) .userInterfaceColors( ovalViewStartColor = R.color.white, ovalViewSuccessColor = R.color.approve_green, appFontColor = R.color.white, manualButtonColor = R.color.white ) .userInterfaceTexts( faceIsTooFarText = "Face is too far", holdStableText = "Hold stable text", faceNotFoundText = "Face not found text" ) .observer(object : AutoSelfieCaptureObserver { override fun cb(bitmap: Bitmap?) { if (bitmap != null) { //Selfie data is taken, upload method can be triggered now to check result of BIOLogin. uploadSelfie() } } }) .build() fragment?.let { replaceFragmentWithBackStack(R.id.frame_pose_estimation, it) } ``` -------------------------------- ### AaptOptions for TFLite Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Specifies that the 'tflite' file should not be compressed, which is a requirement for using the SelfiePoseEstimation module. ```groovy aaptOptions { noCompress "tflite" } ``` -------------------------------- ### Amani SDK Selfie API Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Provides methods for interacting with the selfie capture functionality within the Amani SDK. ```APIDOC Selfie: start(type_of_document: String, callback: IFragmentCallBack): - Returns a Fragment for manual selfie capture. - type_of_document: A string identifying the type of document for capture (e.g., "XXX_SE_0"). - callback: An interface with a `cb` method that receives the captured Bitmap, a boolean indicating if the manual button was activated, and the captured File. onException(onException: ExceptionCallBack): - Sets a callback to handle non-fatal exceptions that occur within the selfie fragment. - onException: An interface with an `onException` method that receives the caught Exception. upload(context: Context, type_of_document: String, callback: IUploadCallBack): - Uploads the captured selfie data. - context: The Android Context. - type_of_document: A string identifying the type of document for capture (e.g., "XXX_SE_0"). - callback: An interface with a `cb` method that receives a boolean `isSuccess`, a String `result` (expected to be "OK" on success), and a MutableList of `Errors` if any occurred during upload. // Related Interfaces: IFragmentCallBack: cb(bitmap: Bitmap?, manualButtonActivated: Boolean?, file: File?) ExceptionCallBack: onException(exception: Exception) IUploadCallBack: cb(isSuccess: Boolean, result: String?, errors: MutableList?) Errors: // Represents potential errors during upload. Specific fields depend on SDK implementation. ``` -------------------------------- ### IUploadCallBack Interface Implementation Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Defines the callback interface for handling upload results. The `cb` function receives a boolean indicating success, a string result, and a mutable list of errors. ```kotlin object : IUploadCallBack{ override fun cb( isSuccess: Boolean, result: String?, errors: MutableList? ) { //isSuccess means the Selfie Data is uploaded //result is the result of uploaded document it should be equal "OK" // if the current Selfie has no error //If Selfie has errors, errors object will not be null anymore } } ``` -------------------------------- ### Required App Permissions Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Lists the essential Android permissions required for the Amani SDK to function, including camera, location, internet, storage, and NFC access. These permissions must be declared in the application's AndroidManifest.xml file. ```xml ``` -------------------------------- ### Upload Manual Selfie Data Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Uploads the selfie data captured using the Manual Selfie feature. It requires the context, document type, and a callback to handle the upload result, including success status and potential errors. ```kotlin Amani.sharedInstance() .Selfie() .upload( this, "type_of_document example: XXX_SE_0", object : IUploadCallBack{ override fun cb( isSuccess: Boolean, result: String?, errors: MutableList? ) { //isSuccess means the Selfie Data is uploaded //result is the result of uploaded document it should be equal "OK" // if the current Selfie has no error //If Selfie has errors, errors object will not be null anymore } } ) ``` -------------------------------- ### Handle Exceptions in Fragment Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet demonstrates how to handle non-fatal exceptions within a fragment using an ExceptionCallBack. It suggests logging the error and informing the user. ```kotlin object : ExceptionCallBack{ override fun onException(exception: Exception) { /** * Triggering this block indicates that there is a non-fatal error caught in the * fragment that will not crash your application. * * In such cases, you can log the error to your crash service to report it to * the Amani Mobile team later. * * Then, you can send a message to the user informing them of the error and * remove the fragment from the back stack with your fragment manager. */ } } ``` -------------------------------- ### Fragment Replacement with Null Check Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This code snippet shows how to safely replace a fragment in a container, ensuring that the fragment object is not null before performing the replacement. This is a common pattern for managing UI navigation. ```kotlin fragment?.let { replaceFragmentWithBackStack(R.id.frame_pose_estimation, it) } ``` -------------------------------- ### Upload Generic Documents from Byte Array Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Uploads generic documents that are provided as a ByteArray. This method takes an ArrayList of FileWithType objects, where each object contains the document's byte array and its file type. It supports uploading up to 10 documents. ```java // Uploading Generic Documents that taken as ByteArray (Not from camera, will be provided from as static data as ArrayList of //FileWithType data class that will be provided from AmaniSDK.) FileWithType docData1 = new FileWithType(byteArrayOfPdf,"pdf"); // An object data class first param: byteArray, second param: type (file type: jpeg,pdf,png etc.) FileWithType docData2 = new FileWithType(byteArrayOfJpeg, "jpeg"); ArrayList docDataList = new ArrayList<>(); // List of files that will be given to upload. docDataList.add(docData1); // Adding first document data docDataList.add(docData2); // Second document data ... // Up to 10 document uploads have been tested without any problems. Amani.sharedInstance().Document().upload(this,"TUR_ID_1",docDataList,(iSuccess,result,listOfErrors)->{ if (isSuccess)//Upload is SUCCESS! }); ``` -------------------------------- ### Confirm Next Signature Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md Allows the process to move to the next signature capture if multiple signatures are required. ```java Amani.sharedInstance().Signature().confirm(context); ``` -------------------------------- ### Configure TFLite for Auto Selfie Capture Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet shows how to configure the `aaptOptions` in your Gradle build file to include 'tflite' for the AutoSelfieCapture module. This is a mandatory step to avoid compilation errors. ```groovy aaptOptions { noCompress "tflite" } ``` -------------------------------- ### Upload Selfie Data Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This code snippet shows how to upload the captured selfie data using the `upload` method. It's crucial to call this method only after a successful capture to avoid errors. ```kotlin //Uploading the current taken Selfie data Amani.sharedInstance() .AutoSelfieCapture() .upload( this, ``` -------------------------------- ### Upload Selfie Data Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This snippet shows how to upload selfie data using the Amani SDK. It requires the current activity context, a document type string, and an IUploadCallBack to handle the upload result (success, result string, or errors). The upload should only be called after a successful pose estimation. ```kotlin Amani.sharedInstance() .SelfiePoseEstimation() .upload( this, "type_of_document example: XXX_SE_0", object : IUploadCallBack{ override fun cb( isSuccess: Boolean, result: String?, errors: MutableList? ) { } }) ``` -------------------------------- ### Configure TFLite Compression Source: https://github.com/amanitechnologiesltd/android_sdk_v2_public/blob/main/README.md This configuration prevents compression of TFLite files, which is necessary for the SelfiePoseEstimation module to function correctly. It should be added to the `aaptOptions` section of your Gradle build file. ```groovy aaptOptions { noCompress "tflite" } ```