How to use the jpush-react-native.initPush function in jpush-react-native

To help you get started, we’ve selected a few jpush-react-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrarronz / react-native-blog-examples / Chapter13-PushNotification / PushNotification / App.js View on Github external
componentDidMount() {
    if (Platform.OS === 'android') {
      JPushModule.initPush();
      // 设置android端监听
      JPushModule.notifyJSDidLoad(resultCode => {
        if (resultCode === 0) {
          console.log("设置监听成功");
        }
        JPushModule.addGetRegistrationIdListener((registrationId) => {
          console.log("设备注册成功,registrationId: " + registrationId);
        });
      });
    }
    JPushModule.addReceiveNotificationListener((map) => {
      console.log("收到推送消息");
      console.log(map);
      // TODO: 处理通知消息
    });
    JPushModule.addReceiveOpenNotificationListener((map) => {
github duheng / Mozi / src / AppNavigationState.js View on Github external
componentDidMount() {
    if (Platform.OS === 'android') {
      // 通知 JPushModule 初始化完成,发送缓存事件。
      JPushModule.notifyJSDidLoad(() => {});
    } else {
      JPushModule.initPush();
    }

    // 接收自定义消息
    JPushModule.addReceiveCustomMsgListener(message => {
      // this.setState({ pushMsg: message, });
    });
    // 接收推送通知
    JPushModule.addReceiveNotificationListener(message => {
      // console.log(`receive notification: ${message}`);
    });
    // 打开通知
    JPushModule.addReceiveOpenNotificationListener(() => {
      console.log('Opening notification!');
      !!this.root && this.root._navigation.navigate('Gong');
    });
  }
github syun0216 / goforeat / app / hoc / CommonHOC.js View on Github external
_jpush_android_setup() {
      JPushModule.initPush();
      JPushModule.notifyJSDidLoad(resultCode => {
        if (resultCode === 0) {
        }
      });
    }
github syun0216 / goforeat / goforeat_app / app / components / HomePageHOC.js View on Github external
_jpush_android_setup = () => {
    JPushModule.initPush();
    JPushModule.notifyJSDidLoad(resultCode => {
      if (resultCode === 0) {
      }
    })
  }