Expo React Native Guide
Learn about OkHi's integration for verifying addresses.
Make sure you are running an Android Expo development build. See how to enable development builds here.
Installation
To install the OkHi React Native library run the command bellow
Android
Enable Expo Android Development build
If you haven't done this already, make sure you are running an android development build. You can achieve this by running the bellow command in your projects root directory.
At this point you should be able to navigate to android/
Configuration
Permissions
Add the following permissions to your AndroidManifest.xml
located under android/app/src/main/AndroidManifest.xml
Maven Repo
In your android/build.gradle
add the OkHi Maven repo to the list of repositories i.e
iOS
Enable Expo iOS Development build
If you haven't done this already, make sure you are running a ios development build. You can achieve this by running the bellow command in your projects root directory.
At this point you should be able to navigate to ios/
Configuration
Enable Background modes
OkHi obtains verification signals in the background, to enable this make sure to add "Location updates" and "Background fetch" to your Background Modes under Signing & Capabilities of your target.
Permissions
Add necessary permissions to your info.plist
file located under /ios/MyApp
AppDelegate
Open your AppDelegate.mm
file located under ios/MyApp/AppDelegate.mm
and add the following lines
Install pods
If you have your project running, stop it and run the bellow command. It'll install all the necessary pods.
Usage
important: initialisation has to be done each time on app start and shouldn't have any blocking operations before it. See full integration example
Add address endpoint (Server-side)
Here's a sample address payload that the client would get on successful address collection:
Create a secure endpoint on your server that your app can use to pass address details to your server. Remember to handle corner cases such as, address updates & multiple addresses if your app supports it.
Handle verification events (Server-side)
OkHi sends verification status updates over a few days while verification is on going. Follow the webhook guide to setup a webhook and receive these verification status updates and run actions such as upgrading a user's KYC level.
Show verification status in app(Server- & Client-side)
Create a secure endpoint to enable your app to retrieve address details, including the verification status received from the webhook
Show the resulting address details and status on the address page in your app.
Test the integration
Title | Scenario | How to test |
---|---|---|
Create an address | Address creation succeeds and verification is initiated | Launch OkHi's address manager via the button you created and create an address. A sticky notification appears on android. |
Dashboard | When verification is initiated, the address shows up on OkDash | |
Proof of address | When an address is verified, the webhook receives the status update and the app shows the correct verification status. A proof of address certificate is made available on OkDash. | Install your app on your personal device that you move around with and create your home address. Check OkDash in 3 days for your proof of address certificate once your address has been verified. |
Business logic | When an address is verified or not, the correct business logic is applied successfully. | Conduct a comprehensive test with multiple users, wherein they create various addresses to observe diverse outcomes. These outcomes may include successful creation of home addresses, entering incorrect addresses, refusing to grant necessary location permissions, or uninstalling the app immediately after initiating the address verification process, among other scenarios. |
Customise the integration
Create a location permissions primer (Required)
Create your custom location permissions primer to educate your user on the requirement for location permissions. Make sure to follow our design best practices to ensure you meet the Google Play store and AppStore requirements.
Customise OkCollect (optional)
It is possible to completely transform the default appearance of OkHiLocationManager to better match your brand by providing values to the theme
prop
Customising address type
You may turn off either of the OkHi address types. This is to allow your users to create either home or work addresses to better suit your use-case. By default both address types are on.
Customise notification icon & color
You can specify a custom default icon and a custom default color by adding these lines inside the application
tag to set the custom default icon and custom color. You'll need to have already created the icon resource in your android application. Icon assets can be created by following these steps
Getting ready to go live
Production credentials
Notify us that you'd like to cut a production build so we can supply production credentials.
Prepare for submission to Google Play store and App Store
Submitting an app to Google Play store and App Store that has background location permissions has a few extra requirements. Follow these guide to know what to expect and how to handle the extra requirements:
Publishing to Google Play store
Troubleshooting
Incase you run into problems while integrating, review common issues here:
React Native troubleshoot guideNext steps
Review Full integration sample project
Last updated