react-native-one-audience

1.0.0 • Public • Published

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]

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-one-audience and add RNOneAudience.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNOneAudience.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. 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);
}

Package Sidebar

Install

npm i react-native-one-audience

Weekly Downloads

1

Version

1.0.0

License

none

Unpacked Size

387 kB

Total Files

14

Last publish

Collaborators

  • zsajjad