CLI
If you are building your app without using a Framework.
External Dependencies
Apart from the core React Native libraries, there are no additional external React Native library dependencies.
For external dependencies in the native SDKs, check out this page for Android and this one for iOS.
Steps
Install the Sentiance Core React Native module
Run the command in Terminal:
npm install @sentiance-react-native/coreThe module should now be added to your project's package.json file.
{
...,
"dependencies": {
...,
"@sentiance-react-native/core": "^6.x.x"
}
}The @sentiance-react-native/core module must be installed before using any other Sentiance service.
Setup the Build Dependencies in the native folders
iOS Build Dependencies
In the terminal, navigate to your project's iOS directory
Run the command in Terminal:
pod install --repo-updateAndroid Build Dependencies
Add the Sentiance repository to your project-level build.gradle file:
allprojects {
repositories {
...
maven { url "https://repository.sentiance.com" }
}
}This will allow Gradle to find and download the necessary native Sentiance SDK libraries.
Configuration and permissions
Next, we'll configure the project settings and permissions for both iOS and Android.
iOS Configuration and Permissions
Open your existing app project in Xcode.
For project and permission settings, follow these 3 steps from the Native iOS Setup guide:
Android Configuration
When the Sentiance SDK runs in the background, it starts a foreground service. This causes Android to display a notification in the notification shade, and an icon on the system bar.
To customize this notification, you can update the AndroidManifest.xml file as follows:
<application ...>
<meta-data android:name="com.sentiance.react.bridge.core.notification_id" android:value="1001"/>
<meta-data android:name="com.sentiance.react.bridge.core.notification_title" android:resource="@string/app_name"/>
<meta-data android:name="com.sentiance.react.bridge.core.notification_text" android:value="Touch to open."/>
<meta-data android:name="com.sentiance.react.bridge.core.notification_icon" android:resource="@mipmap/ic_launcher"/>
<meta-data android:name="com.sentiance.react.bridge.core.notification_channel_name" android:value="Detections"/>
<meta-data android:name="com.sentiance.react.bridge.core.notification_channel_id" android:value="sentiance_detections"/>
...
By customizing the notification, you can tailor the appearance and behavior of the notification to match the branding and user experience of your application. This allows you to provide a seamless and consistent experience to your users while the Sentiance SDK operates in the background.
Please note that customizing the notification should be done carefully to ensure that it complies with Android guidelines and user preferences. By doing so, you can enhance the overall user experience and maintain a cohesive presentation of your app and the Sentiance SDK's background functionality.
Next: Initialize the SDK
After having included the Sentiance SDK, proceed to initializing the SDK.
Last updated