Hi, i am using FCM with Firebase functions to send notifications based on some effects,
it works fine send notifications and i receive them but when i click on the notification i get nothing and in the logs i get this message:
Sending FCMNotificationReceived with no listeners registered.
in my functions her is the payload sent:
const payload = {
notification: {
'title': formatedData.titre,
'body': formatedData.commande
}
};
const options = {
priority: "high",
content_available: true,
};
return admin.messaging()
.sendToDevice("user_token", payload, options);
})
and in my react i have this in componentDidMount:
componentDidMount() {
FCM.requestPermissions();
FCM.getFCMToken().then(token => {
console.log("TOKEN (getFCMToken)", token);
this.setState({token: token});
});
FCM.subscribeToTopic('mes-annonces');
FCM.getInitialNotification().then(notif => {
console.log("INITIAL NOTIFICATION", notif);
alert('got a notification '+notif);
});
this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
console.log('event notification'+notif);
alert('got notif' + notif);
if(notif.opened_from_tray) {
alert('clicked on notification');
console.log('got a opened_from notification');
}
if(notif.local_notification) {
console.log('got a local notification');
}
if (Platform.OS === 'ios') {
switch (notif._notificationType) {
case NotificationType.Remote:
notif.finish(RemoteNotificationResult.NewData); //other types available: RemoteNotificationResult.NewData, RemoteNotificationResult.ResultFailed
break;
case NotificationType.NotificationResponse:
notif.finish();
break;
case NotificationType.WillPresent:
console.log('in the method');
notif.finish(WillPresentNotificationResult.All); //other types available: WillPresentNotificationResult.None
break;
}
}
this.showLocalNotification(notif);
});
FCM.on(FCMEvent.RefreshToken, token => {
console.log(token);
})
}
sorry it was my fault, this code was in file that wasn't mount :/ the issue can be closed
Hello @googl3r
I am also getting this issue and i have the same code which is working fine for Android but giving this error in iOS.
Please guide.
Any update on that?
Any solutions for that ??
Any solutions for that ?? [2]
i have same issue and i am not even recieving any notification but "Sending FCMNotificationReceived with no listeners registered" every time i send message from server
can someone please tell whether this issue from APNs or Firebase wrong setting or firebase cocoapods i installed
if it from cocoapod install then i will remove cocoapod and install firebase sdk manualy
Most helpful comment
Hello @googl3r
I am also getting this issue and i have the same code which is working fine for Android but giving this error in iOS.
Please guide.