友盟推送 React Native.
Getting Started
First, cd to your RN project directory, and install RNMK through rnpm . If you don't have rnpm, you can install RNMK from npm with the command npm i -S tnrn-umeng-push and link it manually (see below).
iOS
-
React Native < 0.46 (Using rnpm)
rnpm install tnrn-umeng-push -
React Native >= 0.46
$npm install -S tnrn-umeng-push$react-native link tnrn-umeng-push
Manually
- Add
node_modules/tnrn-umeng-push/ios/RNUMPush.xcodeprojto your xcode project, usually under theLibrariesgroup - Add
libRNUMPush.a(fromProductsunderRNUMPush.xcodeproj) to build target'sLinked Frameworks and Librarieslist - Add ocr framework to
$(PROJECT_DIR)/Frameworks.
Android
-
React Native < 0.46 (Using rnpm)
rnpm install tnrn-umeng-push -
React Native >= 0.46
$npm install -S tnrn-umeng-push$react-native link tnrn-umeng-push
Manually
- JDK 7+ is required
- Add the following snippet to your
android/settings.gradle:
include ':tnrn-umeng-push'
project(':tnrn-umeng-push').projectDir = new File(rootProject.projectDir, '../node_modules/tnrn-umeng-push/android/app')- Declare the dependency in your
android/app/build.gradle
dependencies {
...
compile project(':tnrn-umeng-push')
}- Import
import io.tnrn.splashscreen.SplashScreenPackage;and register it in yourMainActivity(or equivalent, RN >= 0.32 MainApplication.java):
@Override
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new SplashScreenPackage(MainActivity.activity, true)
);
}Finally, you're good to go, feel free to require tnrn-umeng-push in your JS files.
Have fun!
Basic Usage
Import library
import RNUMPush from 'tnrn-umeng-push'
Questions
made with
♥