Skip to main content

Integration

For IOS Devices

Update Podfile

Since our SDK is an dynamic framework you have to update your Podfile for dynamic frameworks.

source "https://github.com/AmaniTechnologiesLtd/Mobile_SDK_Repo"
source "https://github.com/CocoaPods/Specs"

On post install hook, modify as shown below.

post_install do |installer|
installer.pods_project.build_configurations.each do |config|
#if you have intel Mac you need to comment out following line
#config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
xcode_base_version = `xcodebuild -version | grep 'Xcode' | awk '{print $2}' | cut -d . -f 1`

installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
# This block is for Xcode 15 updates
if config.base_configuration_reference && Integer(xcode_base_version) >= 15
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
if target.name == 'AmaniSDK'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
if target.name == 'AmaniUI'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end
end

IMPORTANT NOTE ABOUT DYNAMIC FRAMEWORKS

Since the underlying native SDK is dnyamic. You should install pods with

USE_FRAMEWORK=dynamic NO_FLIPPER=1 pod install

otherwise you'll encounter build issues about missing headers.

Building for devices that don’t support NFC

For not NFC supported device (like iPhone 6) there is no CoreNFC library in system and also we are using some ios crypto libraries for reading nfc data supported after iOS 13. You need to add below listed libraries as optional under Build Phases->Link Binary With Libraries menu. Even if you don't use the nfc process, you should add.

CoreNFC.framework
CryptoTokenKit.framework
CryptoKit.framework

For Android Devices

Dependencies

  1. Add the following dependencies to your Module build.gradle file.
implementation 'ai.amani:Android.SDK.UI:1.0.0'
  1. On your module’s build.gradle file under the android/app/build.gralde add the changes below inside of android section.
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
dataBinding { enabled true }
  1. Add the following in the Project build.gradle within in buildscript within the buildscript->repositories and buildscript->allprojects.
    maven { url "https://jfrog.amani.ai/artifactory/amani-sdk" }
maven { url "https://www.jitpack.io" }
jcenter()

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