1.0.3 • Published 7 years ago
rn-pushe v1.0.3
rn-pushe
Getting started
$ npm install rn-pushe --save
Mostly automatic installation
$ react-native link rn-pushe
Manual installation
iOS
- In XCode, in the project navigator, right click Libraries➜Add Files to [your project's name]
- Go to node_modules➜rn-pusheand addRNReactNativePushe.xcodeproj
- In XCode, in the project navigator, select your project. Add libRNReactNativePushe.ato 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.reactlibrary.RNReactNativePushePackage;to the imports at the top of the file
- Add new RNReactNativePushePackage()to the list returned by thegetPackages()method
- Append the following lines to android/settings.gradle:include ':rn-pushe' project(':rn-pushe').projectDir = new File(rootProject.projectDir, '../node_modules/rn-pushe/android')
- Insert the following lines inside the dependencies block in android/app/build.gradle:compile project(':rn-pushe')
Windows
- In Visual Studio add the RNReactNativePushe.slninnode_modules/rn-pushe/windows/RNReactNativePushe.slnfolder to their solution, reference from their app.
- Open up your MainPage.csapp
- Add using React.Native.Pushe.RNReactNativePushe;to the usings at the top of the file
- Add new RNReactNativePushePackage()to theList<IReactPackage>returned by thePackagesmethod
Usage
import Pushe from "rn-pushe";
// TODO: What to do with the module?
pushe.initialize(false);
// return pushe id
try {
  console.log(await pushe.getPusheId());
} catch {}
// return true if Pushe is Initialized
try {
  console.log(await pushe.isPusheInitialized());
} catch {}