1. React Native Checklist

triangle-exclamation

Follow the step below to integrate the ReactNative Bridge (SDK).

1. Installation

chevron-right1.1 Dependencyhashtag
npm install --save react-native-sentiance

2. iOS Setup

chevron-right2.1 Pod Installationhashtag

Install the iOS SDK

cd ios
pod install
chevron-right2.2 Configuration: Background Modeshashtag

Ensure you turn on Background Modes and enable Location updates

chevron-right2.2 Configuration: Permissionshashtag

Ensure you include the following permission in info.plist

NSLocationAlwaysAndWhenInUseUsageDescription
NSMotionUsageDescription (Recommended)
chevron-right2.3 Background Detectionshashtag

Include the following line in the application didFinishLaunchingWithOptions method of your AppDelegate.m file

3. Android Setup

chevron-right3.1 Dependencyhashtag

Add the Sentiance repository to your project (top-level) build.gradle file.

In the build.gradle file of your app module, add the following line to the dependencies section.

chevron-right3.2 Notification & Foreground Servicehashtag

Depending on your app's configuration and OS version, the SDK may need to start a foreground service every now and again. You must therefore pass a notification that can be used by the service. In the next section, you'll find a handy notification creation method.

Learn more on how to easily setup a sample notificationarrow-up-right

4. Data Collection & SDK User Creation

In order for the SDK to collect data the application would need to first "create a user" on the SDK. The "createUser" should ideally be called when the user registers, logs in.

chevron-right4.1 createUserhashtag

Invoke the RNSentiance.createUserExperimental method at the moment you are ready to start the data collection. (e.g on user login, on user registration, at a feature, etc)

chevron-right4.2 linkerhashtag

This method will receive the parameters: installId, done

chevron-right4.3 User linking in your backendhashtag

In the link function, at this point, make your backend tell the Sentiance backend the userId that should be related to the installId

chevron-right4.3 done()hashtag

Upon your backend successfully performing the user linking execute the

In case your backend was unable to perform the linking execute done(false)

Verifying the Integration

You can verify the SDK integration by reading the following statuses from the SDK

RNSentiance.getInitState()

INITIALIZED

RNSentiance.getSdkStatus().startStatus

STARTED

Note: If you find the startStatus to be PENDING it usually implies that the user has not granted location:always permission. To know more, click herearrow-up-right__

You can continue reading through the next sections to get a deeper understanding of the integration and the SDK capabilities.

Last updated