Expo
Using the native iOS/Android WebView implies some extra setup in your Expo project. This setup involves incorporating the IntelliProve plug-in Mobile SDK as a pre-packaged Expo Module and adding the necessary bridging code.
All this is nicely laid out in our step-by-step guide below.
The integration guide covers two sections:
- Setting up the Expo Module
- Interfacing with the Native code from Expo (bridging)
Our GitHub repository provides a fully functional example of our platform's integration, demonstrating the seamless setup and utilisation of our pre-packaged Expo Module.
For this guide, we assume a minimal 'Hello World' application generated by the Expo project initialisation.
- Copy the expo-intelliprovewebview-0.1.0.tgz tarball into your Expo App root directory.
- In your Expo App root directory, execute npm install /path/to/tarball/expo-intelliprovewebview-0.1.0.tgz.
We need to configure the minimum deployment target of the application, and allow Camera Usage by the application.
- Open app.json and add:
- Then run npx pod-install to ensure all iOS dependencies are added to your application.
Run npx expo prebuild --clean first if you don't have an ./ios folder.
- Run npx expo install expo-build-properties. This allows you to edit the gradle build properties for the Android application.
- Then in app.json add the following, so we can set the correct SDK versions and permissions:
We also need to do some updates to the Android Manifest, so we can run the IntelliProve module from the application.
- First, create a file at plugins/withIntelliProveAndroidManifest.js relative to the Expo Application root folder.
- In that file, add the following code:
- Finally, add the following to app.json:
While many possibilities exist to bridge the gap between Native iOS/Android and Expo, this document serves as a guide to integrating the IntelliProveSDK into an Expo application project.
To be able to call functions on, and receive callbacks from the IntelliProve Expo Module, we need to import it in the Expo application.
- Open App.tsx or wherever in the Expo app that the IntelliProve web view will be used. (For newer Expo projects, add the code to the RootLayout in the _layout.tsx file instead.)
- Add the following imports:
- Add a function handleOpenWebView that calls the IntelliProve Expo Module to present the Web View
- Also add a callback handler for receiving 'PostMessage' messages.
- The post messages allow you to track the progress of the Face Scan and obtain the results from the IntelliProve plug-in immediately after the user has performed the Face Scan. This allows you to use the results in your mobile app, enabling you to link actions to the results or design a custom results screen.
- Finally, we call the handleOpenWebView()function from wherever the entry point to the WebView should be. The URL to open the IntelliProve WebApp including the action_token is also passed to this function. In our example, it is added on a Button press handler:
The WebView is automatically dismissed by the SDK when receiving the dismiss post message.
Now run the application as you normally would, for example:
- npx expo prebuild --clean
- npx expo run:ios or npx expo run:android
- To match the plug-in with your brand's colours and fonts, please visit our Customisation documentation.