react-native-fcm
react-native-fcm copied to clipboard
this.notificationListner not getting called.
componentDidMount() {
FCM.requestPermissions({badge: true, sound: true, alert: true}).then(()=>console.log('granted')).catch(()=>console.log('notification permission rejected'));
FCM.getInitialNotification().then(notif => {
console.log("INITIAL NOTIFICATION", notif)
});
this.notificationListner = FCM.on(FCMEvent.Notification, notif => {
console.log("Notification", notif);
if(notif.local_notification){
console.log('LOG GOLD');
return;
}
if(notif.opened_from_tray){
console.log('LOG SILVER');
return;
}
});
}
This is my code. It seems I'cant make this.notificationListner to work. Console.log not getting called. getinitialnotification works fine. Please help.
Are you calling this.notificationListner anywhere?
i got same problem, i got this function triggered when get notification + app killed, remoteMessage = null