Android Integration

This document will cover integration steps for Android side of your ReactNative application.

Installation

Step 1: Install Package.

npm install @suprsend/react-native-sdk@latest
yarn add @suprsend/react-native-sdk@latest

Step 2: Add the below dependency in project level build.gradle, inside allprojects > repositories.

allprojects {
  repositories {
    ...
    mavenCentral()  // add this
  }
}

Step 3: Add Android SDK dependency inside in app level build.gradle.

dependencies {
  ...
  implementation 'com.suprsend:rn:0.1.10' // add this
}

🚧

Note

If you get any error regarding minSdkVersion please update it to 19 or more.


Initialization

Step 1: Initialise the Suprsend android SDK in MainApplication.java inside onCreate method and just above super.onCreate() line.

import app.suprsend.SSApi; // import sdk
...
SSApi.Companion.init(this, WORKSPACE KEY, WORKSPACE SECRET); // inside onCreate method just above super.onCreate() line

Replace WORKSPACE KEY and WORKSPACE SECRET with your workspace values. You will get them the tokens from Settings -> API keys inside Suprsend dashboard.


Step 2: Import SuprSend SDK in your client side Javascript code.

import suprsend from "@suprsend/react-native-sdk";

Logging

By default the logs of SuprSend SDK are disabled. You can enable the logs just in debug mode while in development by the below condition.

suprsend.enableLogging(); // available from v2.0.2

// deprecated from v2.0.2
suprsend.setLogLevel(level) 
suprsend.setLogLevel("VERBOSE")
suprsend.setLogLevel("DEBUG")
suprsend.setLogLevel("INFO")
suprsend.setLogLevel("ERROR")
suprsend.setLogLevel("OFF")


What’s Next