Initial SDK Setup

  1. npm install react-native-appboy-sdk@latest --save
  2. react-native link
  3. 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" }
  }
}
  1. npm install react-native-appboy-sdk@latest --save
  2. 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

  1. 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.
  2. 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');
WAS THIS PAGE HELPFUL?