This doc will guide you to integrate and verify Contlo SDK in your React Native app.
Step 1: Install Contlo in your project
To install Contlo's React Native plugin, use the npm package manager.
$ cd path_to_your_project
Add the Contlo plugin from npm
$ npm install react-native-contlo
Step 2: Install required libraries
Install the following libraries using node.js in your project. Skip this step if these libraries are already installed.
npm install @react-native-firebase/app
npm install @react-native-firebase/messaging
npm install @react-native-mmkv
npm install @notifee/react-native
npm install react-native-device-info
npm install validator
Step 3: Initialize SDK using API KEY
In your index.js file, initialize the Contlo SDK with your API KEY.
import { ContloFCMService } from 'react-native-contlo'
.
.
.
new ContloFCMService({apiKey: 'xxxxxxxxxxxxxxxxxxxxx'})
.
.
AppRegistry.registerComponent(appName, () => App);
You can find your API KEY in your Contlo Dashboard in the Settings section under the API Tab.
Permissions:
When you create a React Native project, you get specific Android and iOS project folders.
Android
In your Android project, go to your AndroidManifest.xml file, and add the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Note: Your app also requires setup for Firebase. If not done, please follow this link: https://rnfirebase.io/
iOS
Coming soon
Verify Integration:
After initializing the SDK according to the above steps, open the app on a device or emulator. You will see a new Anonymous user created on your Contlo dashboard. This means that you have successfully integrated the Contlo Android SDK.
Welcome aboard!!