react-native-one-audience
v1.0.0
Published
## Getting started
Downloads
2
Readme
React Native OneAudience
Getting started
$ npm install react-native-one-audience --save
Mostly automatic installation
$ react-native link react-native-one-audience
Manual installation
iOS [Not available yet]
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-one-audience
and addRNOneAudience.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNOneAudience.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.fetchsky.RNOneAudiencePackage;
to the imports at the top of the file - Add
new RNOneAudiencePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-one-audience' project(':react-native-one-audience').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-one-audience/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-one-audience')
Usage
import RNOneAudience from 'react-native-one-audience';
...
RNOneAudience.init('your-api-key').then((resp) => {
console.log('INITIALIZED ONE AUDIENCE', resp);
});
export function setEmailAddress(email) {
OneAudience.setEmailAddress(email);
}
export function setAge(age) {
OneAudience.setAge(parseInt(age, 10));
}
export function optOut(email) {
OneAudience.optOut(email);
}