Android Expo Wrapper
-
Setup the Expo 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 ExpoSDK2AndroidResources archive, it consists of the expo, android_resources, reference and android_code directories. Please enter the credentials for Demo environment(URL, Initialize URL, Login ID, Password, Merchant ID) in Home.js.
ExpoSDK2AndroidResources -
Create an empty Expo application
expo init IDMExpo
-
Add Javascript code. Copy and paste the contents of the expo folder to the main project folder. Overwrite files if required.
-
Add Expo dependencies. In package.json change the dependencies node and add resolutions node below it.
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1",
"expo-splash-screen": "~0.14.1",
"@react-navigation/native": "^5.8.10",
"@react-navigation/stack": "^5.12.8",
"native-base": "^2.15.0",
"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 Expo application
npm install
-
Open android directory in Android Studio
-
Add Android code. Add files from android_code directory. Overwrite files if required.
-
Overwrite main build.gradle 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,
- Add following plugins on the top of the file,
- Add following dependencies,
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst '**/*.so'
}
dexOptions{
javaMaxHeapSize "4g"
}
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 on an emulator or physical device by executing the following command in Command Prompt/Terminal,
expo run:android
- On emulator, if the camera does not launch during face capture please try using the back camera. You can specify which camera you want to use in the optional CameraCustomizationOptions parameter. For example, if you want to use back camera for face capture in IDValidationAndMatchFace API call,
CameraCustomizationOptions cameraCustomizationOptions = new CameraCustomizationOptions(null, null, null, CameraFacing.BACK, null, null, null, null, null);
IdentityProofingSDK.INSTANCE.idValidationAndMatchFace(getReactApplicationContext().getCurrentActivity(), null, cameraCustomizationOptions);
- Expo 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.
- The response for all of the API calls is printed in the console log.