JPush's officially supported React Native plugin (Android & iOS). 极光推送官方支持的 React Native 插件(Android & iOS)。
MIT License
npm install jpush-react-native --save
jcore-react-native
npm install jcore-react-native --save
build.gradle
android {
defaultConfig {
applicationId "yourApplicationId" //
...
manifestPlaceholders = [
JPUSH_APPKEY: "yourAppKey", //APPKey
JPUSH_CHANNEL: "yourChannel" //channel
]
}
}
dependencies {
...
implementation project(':jpush-react-native') // jpush
implementation project(':jcore-react-native') // jcore
}
setting.gradle
include ':jpush-react-native'
project(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')
include ':jcore-react-native'
project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
AndroidManifest.xml
<meta-data
android:name="JPUSH_CHANNEL"
android:value="${JPUSH_CHANNEL}" />
<meta-data
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" />
ios.xcworkspace
pod install
pod
pod deintegrate
Libraries
Add Files to "your project name"
node_modules/jcore-react-native/ios/RCTJCoreModule.xcodeproj
node_modules/jpush-react-native/ios/RCTJPushModule.xcodeproj
Capabilities
Push Notification --- ON
Build Settings
All --- Search Paths --- Header Search Paths --- +
$(SRCROOT)/../node_modules/jcore-react-native/ios/RCTJCoreModule/
$(SRCROOT)/../node_modules/jpush-react-native/ios/RCTJPushModule/
Build Phases
libz.tbd
libresolv.tbd
UserNotifications.framework
libRCTJCoreModule.a
libRCTJPushModule.a