$ npm install react-native-customerly --save
$ react-native link react-native-customerly
PAY ATTENTION
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-customerly
and addRNCustomerly.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNCustomerly.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import io.customerly.rn.RNCustomerlyPackage;
to the imports at the top of the file - Add
new RNCustomerlyPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-customerly' project(':react-native-customerly').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-customerly/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-customerly')
- Open you
PodFile
inside ios folder
- If you are using swift version 4.1 and XCode 9.x, add this:
pod 'CustomerlySDK', '2.1.0'
- If you are using swift version 4.2 and XCode 10.x, add this:
pod 'CustomerlySDK', '2.2.1'
- Run
$ pod install
- Open you AppDelegate.m
- Add import
#import <CustomerlySDK/CustomerlySDK-Swift.h>
- Add the following code in your
didFinishLaunchingWithOptions
:[[Customerly sharedInstance] configureWithAppId:@"YOUR_APP_ID"]; [[Customerly sharedInstance] activateApp];
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:repositories { jcenter() } compile 'io.customerly:customerly-android-sdk-supportlibraries:3.0.0'
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import io.customerly.Customerly;
- Inside you onCreate method add the following code:
Customerly.configure(this, "YOUR_APP_ID");
import RNCustomerly from "react-native-customerly";
await RNCustomerly.registerUser(email, userId, name, attributes, company);
RNCustomerly.logoutUser(() => {});
RNCustomerly.openSupport(() => {});
await RNCustomerly.isSdkAvailable();
RNCustomerly.setAttributes(attributes, callback);
RNCustomerly.setCompany(attributes, callback);
RNCustomerly.setSupportEnabled(enabled, callback);
RNCustomerly.isSupportEnabled(callback);
RNCustomerly.setSurveyEnabled(enabled, callback);
RNCustomerly.isSurveyEnabled(callback);
RNCustomerly.trackEvent(eventName, callback);
RNCustomerly.update(callback);
RNCustomerly.setVerboseLogging(enabled, callback);
RNCustomerly.setAttachmentsAvailable(enabled, callback);
For all the explanation and the methods signature you can check directly the native SDK at the following links: