For the complete documentation index, see llms.txt. This page is also available as Markdown.

Expo

If you are using Expo to build your app.

External Dependencies

Apart from the core React Native and Expo 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

1

Install the Sentiance Core React Native module

Run the command in Terminal:

Terminal
npm install @sentiance-react-native/core

The module should now be added to your project's package.json file.

package.json
{
  ...,
  "dependencies": {
    ...,
    "@sentiance-react-native/core": "^x.y.z"
  }
}

The @sentiance-react-native/core module must be installed before using any other Sentiance service.

2

Configure the Sentiance Expo config plugin

Add the Sentiance Core config plugin to your app.json. The plugin takes care of initializing the SDK on app start, configuring the Android foreground service notification and background location permission, and wiring up the required platform-specific hooks on both Android and iOS.

On iOS, the plugin enables the necessary background modes and registers the background task identifier used by the SDK's processing tasks.

On Android, the Sentiance SDK runs a foreground service while operating in the background, which causes the system to display a persistent notification. The android.notification block lets you customize its title, text, icon, and channel to match your app's branding and deliver a consistent experience to your users.

In addition, the plugin automatically declares the background location permission and the activity recognition permission inside the application manifest.

app.json
{
  "expo": {
    "plugins": [
      "...": "...",
      [
        "@sentiance-react-native/core",
        {
          "android": {
            // Optional: customize the foreground service notification
            "notification": {
              "title": "Your App",
              "text": "Running in the background",
              "channelId": "sentiance",
              "channelName": "Sentiance",
              "icon": "notification_icon",
              "id": 1
            }
          }
        }
      ]
    ],
    "ios": {
      "...": "...",
      // Required: location & motion permission descriptions
      "infoPlist": {
        "NSLocationAlwaysAndWhenInUseUsageDescription": "This app uses your location to provide insights.",
        "NSLocationWhenInUseUsageDescription": "This app uses your location to provide insights.",
        "NSLocationAlwaysUsageDescription": "This app uses your location to provide insights.",
        "NSMotionUsageDescription": "This app uses motion data to detect your transportation mode.",
      }
    }
  }
}
3

Next: Initialize the SDK

After having included the Sentiance SDK, proceed to initializing the SDK.

Last updated