Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount() {
JPushModule.setupPush() // if you add register notification in Appdelegate.m 有 don't need call this function
JPushModule.getBadge((badge) => {Alert.alert("badge", badge)})
JPushModule.addnetworkDidLoginListener(() => {
console.log('连接已登录')
JPushModule.addTags(['dasffas'], (result)=> {
Alert.alert('addTags success:' + JSON.stringify(result))
})
})
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('网络已断开')
console.log("Dev");
}
if (Platform.OS == 'android') {
JPushModule.notifyJSDidLoad((resultCode) => {
if (resultCode === 0) { console.log('success') }
});
}
JPushModule.addnetworkDidLoginListener(() => {
console.log('连接已登录')
JPushModule.setBadge(0, (success) => { console.log('setBadge:' + success) });
// JPushModule.addTags(['dasffas'], (result) => {
// Alert.alert('addTags success:' + JSON.stringify(result))
// })
})
JPushModule.addOpenNotificationLaunchAppListener((result) => {
//
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))
})