Suprsend SDK for React Native Applications
Refer full documentation here
npm install @suprsend/react-native-sdk
Inside allprojects repositories add the below mentioned line as android sdk is available at mavenCentral repository
allprojects {
repositories {
...
mavenCentral()
}
}
Add following line of code inside dependencies in app build.gradle
dependencies {
...
implementation 'com.suprsend:rn:0.1.8'
}
NOTE: If you get any error regarding minSdkVersion please update it to 19 or more
Step 1. Initialise the android sdk in MainApplication.java inside onCreate method and just above super.onCreate() line. You can find workspace_key and workspace_secret in dashboard.
import app.suprsend.SSApi; // import sdk
...
SSApi.Companion.init(this, workspace_key, workspace_secret); // inside onCreate method just above super.onCreate() line
import suprsend from "@suprsend/react-native-sdk";
NOTE: If you face any issue in installation or integration please refer the example folder in respository where you can find the integration of sdk in example application.
Please skip this step if you have already installed this package for android setup
npm install @suprsend/react-native-sdk
Our iOS SDK is written in swift language so it's necessary to add swift support in React native project as react native uses Objective-C for iOS. This is just a few steps process.
SuprSend sdk needs iOS platform version of 13 or above, so check it inside PodFile and change if its less than 13.0 and then run pod install from inside iOS folder.
platform :ios, '13.0' // this version has to be 13 or greater
SuprSend sdk needs an iOS deployment target of 11 or above. So Change it in xcode.
Step 1. In AppDelegate.m add the below mentioned code inside didFinishLaunchingWithOptions method, just before returning YES like in code below.
#import <UserNotifications/UserNotifications.h> //add this, needed as sdk internally depends on this package
#import <SuprSendSdk/SuprSendSdk-Swift.h> //add this
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
SuprSendSDKConfiguration* configuration = [[SuprSendSDKConfiguration alloc] initWithKey:@workspace_key secret:@workspace_secret baseUrl:nil]; // add this line
[SuprSend.shared configureWithConfiguration:configuration launchOptions:launchOptions]; // add this line
return YES;
Replace workspace_key and workspace_secret with your values. You will get workspace_key and workspace_secret from client dashboard.
NOTE: If you face any issue in installation or integration please refer the example folder in respository where you can find the integration of sdk in example application.
MIT