Upgrading to OkCollect v1.3 & OkVerify v1.3

The latest releases of OkCollect & OkVerify for Android applications offers new features to help you better manage the address creation and verification process

The latest release of OkCollect & OkVerify introduces some new features that not only improves the rate at which users get verified but improves the overall developer experience, streamlining how to authenticate with the library and cut back the amount of code you have to write and maintain. These features include:

  1. Keys and development environments are now required to be part of your AndroidManifest.xml file, eliminating the need to keep track of your application version, name etc using the OkHiContext class.

  2. You can now customize the icon and icon color of the foreground notification.

  3. The foreground service is now turned on by default so you don't have to call the startForeground method after verification starts.

  4. You can now turn off the foreground service or verification all together for a particular user via a POST request using our API.

  5. The foreground service is automatically stopped when an address is verified.

  6. Internal improvements that further enhance the reliability of background work resulting in less data being used by the device as well as consume less battery.

Getting started

Include the new versions of OkCollect & OkVerify

Remove and re-install all the OkHi libraries in your application

yarn remove @okhi/react-native-core @okhi/react-native-okcollect @okhi/react-native-okverify
yarn add @okhi/react-native-core @okhi/react-native-okcollect @okhi/react-native-okverify

Authorize your application

Place your provided keys in the AndroidManifest.xml file located under android/app/src/main/AndroidManifest.xml as shown bellow.

<application>
    <meta-data android:name="io.okhi.core.branch_id" android:value="<my_branch_id>" />
    <meta-data android:name="io.okhi.core.client_key" android:value="<my_client_key>" />
    <meta-data android:name="io.okhi.core.environment" android:value="sandbox" /> <!-- set this to prod once ready to go live 🚀 -->
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Remove any instances of OkHiAuth and OkHiContext

Given its required to provide your keys in the Manifest file, remove any instantiations of the OkHiClass and OkHiContext from your source code. Using the previous example remove the import statement as shown

Remove the startForegroundVerification call

Given that we now start the foreground service automatically, there's no need to manually start it

Remove the auth object as a parameter from OkCollect

Its no longer required to pass in the OkHiAuth object to both OkCollect & OkVerify.

<OkHiLocationManager
    user={user} // a OkHiUser
    launch={launch} // true | false
    onSuccess={handleOnSuccess}
    onCloseRequest={() => setLaunch(false)} // called when user taps on the top right close button
    onError={handleOnError}
/>

Thats it! You're done 🚀 Be sure to checkout the full integration example & more on OkHi foreground's service to customize the notification icon and color

Last updated