Initial SDK Setup
Using react-native link
npm install react-native-appboy-sdk@latest --save
react-native link
- Add the Braze repository to your project:
1
2
3
4
5
6
| // top-level build.gradle
allprojects {
repositories {
maven { url "https://appboy.github.io/appboy-android-sdk/sdk" }
}
}
|
Without react-native link
npm install react-native-appboy-sdk@latest --save
- Link the project by adding the following:
1
2
3
4
| // settings.gradle
include ':react-native-appboy-sdk'
project(':react-native-appboy-sdk').projectDir = new File(settingsDir, '../node_modules/react-native-appboy-sdk/android')
|
1
2
3
4
5
6
7
| // top-level build.gradle
allprojects {
repositories {
maven { url "https://appboy.github.io/appboy-android-sdk/sdk" }
}
}
|
1
2
3
4
5
| // app build.gradle
dependencies {
compile project(':react-native-appboy-sdk')
}
|
Java changes
Add our AppboyReactPackage
to the getPackages()
method of your Application class.
1
2
3
4
5
6
7
8
| import com.appboy.reactbridge.AppboyReactPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new AppboyReactPackage()
);
}
|
Completing the integration
- Follow the directions at our public documentation to finish your integration. In particular, you will need to set your Braze API key and custom endpoint in a new
appboy.xml
file.
- When you need to make Braze calls from javascript, use the following declaration to import the javascript module:
1
| const ReactAppboy = require('react-native-appboy-sdk');
|