How to use the jpush-react-native.addConnectionChangeListener 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 jiasongs / cnodeRN / index.ios.js View on Github external
Alert.alert('addOpenNotificationLaunchAppListener', 'the notification is :' + JSON.stringify(result))
})

JPushModule.addReceiveOpenNotificationListener((result) => {
  // 点击通知栏进入
  JPushModule.setBadge(0, (success) => { console.log('setBadge:' + success) });
  console.log('1111')
  Alert.alert('addReceiveOpenNotificationListener', JSON.stringify(result))
})

JPushModule.addReceiveNotificationListener((result) => {
  // 收到远程通知
  Alert.alert('addReceiveNotificationListener', JSON.stringify(result))
})

JPushModule.addConnectionChangeListener((result) => {
  if (result) {
    console.log('网络已连接')
  } else {
    console.log('网络已断开')
  }
})

const store = configureStore();
export default class cnodeRN extends Component {
  render() {
    return (
      
        
      
    );
  }
github jpush / jpush-react-native / example / react-native-iOS / push_activity.js View on Github external
})
        })

        JPushModule.addOpenNotificationLaunchAppListener((result) => {
          Alert.alert('addOpenNotificationLaunchAppListener', 'the notification is :' + JSON.stringify(result))
        })

        JPushModule.addReceiveOpenNotificationListener((result) => {
          Alert.alert('addReceiveOpenNotificationListener',JSON.stringify(result))
        })

        JPushModule.addReceiveNotificationListener((result) => {
          Alert.alert('addReceiveNotificationListener',JSON.stringify(result))
        })

        JPushModule.addConnectionChangeListener((result) => {
          if (result) {
            console.log('网络已连接')
          } else {
          console.log('网络已断开')
          }
        })

        // JPushModule.addReceiveNotificationListener((notification) => {
        //   Alert.alert(JSON.stringify(notification))
        // })
    }
    componentDidMount() {