Android React Wrapper
-
Setup the React Native development environment based on the development and target OS by following the steps here,
Setting up the development environment Github Repository -
We will be integrating Android Identity SDK version 9.3.10.2.9. Download and unzip the ReactNativeResources archive, it consists of the react-native, android_resources, reference and android_code directories. Please enter the credentials(URL, initialize URL, Login ID, Password, Merchant ID) in Home.js.
ReactNativeSDK2AndroidResources -
Create an empty React Native application
npx react-native init IDMTest
-
Add Javascript code. Copy and paste the contents of react-native folder to the main project folder. Overwrite files if required.
-
Add React Native dependencies. In package.json change the dependencies node and add resolutions node below it.
"dependencies": {
"@react-navigation/native": "^5.8.10",
"@react-navigation/stack": "^5.12.8",
"native-base": "^2.15.0",
"react": "17.0.2",
"react-native": "0.67.3",
"react-native-gesture-handler": "^1.9.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-navigation": "^4.4.4"
},
- Delete node_modules folder. Build React Native application
npm install
-
Open android directory in Android Studio
-
Add Android code. Add files from android_code directory. Overwrite files if required.
- Modify Manifest file. An example is available in the reference directory.
- Add following property to manifest node in manifest file,
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:name,android:allowBackup"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
- Overwrite main build.gradle, proguard-rules.pro file from android_resources.
- Modify app project’s build.gradle. An example is available in the reference directory.
- Add following plugins on the top of the file,
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
compileSdkVersion 32
buildToolsVersion "30.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst '**/*.so'
}
dexOptions{
javaMaxHeapSize "4g"
}
minSdkVersion 23
targetSdkVersion 32
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
implementation "androidx.appcompat:appcompat:1.3.1"
implementation 'com.idmission.sdk2:idmission-sdk:9.3.10.2.9'
- Sync Now the code in Android Studio
- Build and run the android app,
npx react-native run-android --port=8081
- React sample app Download link
- Here is a brief description of the sample app functionality,
- The initialize API call is executed when the app is launched.
- Keyboard - The keyboard on top is used to type the Unique Customer Number which is required for Service ID 50, 175, 105 flows.
- ID Validation - Initiates ID Validation(Service ID 20) flow.
- ID Validation and Match Face - Initiates ID Validation and Match Face(Service ID 10) flow.
- ID Validation and Customer Enroll - Initiates ID Validation and Customer Enroll(Service ID 50) flow.
- Customer Enroll Biometrics - Initiates Customer Enroll Biometrics(Service ID 175) flow.
- Customer Verification - Initiates Customer Verification(Service ID 105) flow.
- Identify Customer - Initiates Identify Customer(Service ID 185) flow.
- Live Face Check - Initiates Live Face Check(Service ID 660) flow.
- Submit - Submits the form.