Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.14 KB

极光推送配置.md

File metadata and controls

45 lines (33 loc) · 1.14 KB

极光配送相关配置

当前版本

 "react": "16.8.3",
 "react-native": "0.59.8"

安装模块

安装模块: npm install jpush-react-native jcore-react-native --save 在link 前 请先注册极光推送的账号

  • link: react-native link jpush-react-native // 输入appkey(测试账号推送) e6e7be37a7eb6ad61670042c
  • link: react-native link jcore-react-native

项目配置

1、AndroidManifest.xml 配置

在 application 标签 里面添加

<meta-data android:name="JPUSH_APPKEY"  android:value="${JPUSH_APPKEY}" />
<meta-data  android:name="JPUSH_CHANNEL"  android:value="${APP_CHANNEL}" />

2、app下的 MainApplication.java 添加如下代码

import cn.jpush.reactnativejpush.JPushPackage; // 极光推送

// 设置为true将不弹出toast
    private boolean SHUTDOWN_TOAST = false;
    // 设置为true将不打印log
    private boolean SHUTDOWN_LOG = false;

@Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(new MainReactPackage(),
          ....
            new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)
          ....
    }