Skip to main content

Preparation

Amani SDK-UI package is an interface package prepared using Amani-SDK-V2. You can use this package directly by cloning and modifying it, or you can install the AAR package via jitpack with the following implementation without changing the interface.

Required Permissions

This SDK makes use of the devices Camera, Location and NFC permissions. If you don't want to use location service, please provide in init method.

You must have the folowing keys in your application's manifest file:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.NFC" />

Requirements

The minimum requirements for the SDK are:

  • API Level 21
  • compileSDKVersion 34

ProGuard Rule Usage

  • If you are using ProGuard in your application, you just need to add this line into your ProGuard Rules!
    -keep class com.amani_ml** {*;}
-dontwarn com.amani.ml**
-keep class datamanager.** {*;}
-dontwarn datamanager.**
-keep class networkmanager.** {*;}
-dontwarn networkmanager.**
-keep class com.amani_ai.jniLibrary.CroppedResult { *; }

-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**

Integration

1. Add the SDK Dependency

Ensure your project is configured to use JitPack as a repository source.

Settings in settings.gradle:

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven {
url = "https://jfrog.amani.ai/artifactory/amani-sdk"
}
maven {
url = "https://jitpack.io"
}
}
}

Dependency in build.gradle:

Replace Tag with the latest appropriate release as

implementation 'ai.amani:Android.SDK.UI:Tag'

2. Configure Gradle

Enable data binding and use the aaptOptions block in your Android Gradle configuration to ensure TensorFlow Lite model files (.tflite) are not compressed during the APK packaging process.

android {
// Enable data binding
dataBinding {
enabled = true
}

// Configure aaptOptions to prevent compression of .tflite files
aaptOptions {
noCompress "tflite"
}
}