question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sending `FCMNotificationReceived` with no listeners registered.

See original GitHub issue

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);
    })
    }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

11reactions
aditya27devcommented, Sep 8, 2017

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.

0reactions
yusuf987commented, Mar 31, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

can't receive notification in ios : sending FcmTokenRefreshed ...
i send notification with fire-base , in ios app i have this error : sending FcmTokenRefreshed with no listeners registered if app opened ......
Read more >
evollu/react-native-fcm - Gitter
Hi all. I am getting an error: method does not override or implement from a supertype and it's in FIRMessagingModule.java. Thanks for the...
Read more >
a resolved google play services library dependency depends on ...
As a work around you can send data message (no notification payload at all) and this repo will build a local notification for...
Read more >
[Solved]-can't receive notification in ios - appsloveworld
Coding example for the question can't receive notification in ios : sending FcmTokenRefreshed with no listeners registered-React Native.
Read more >
Cloud Messaging | React Native Firebase
If you're using an older version of React Native without auto-linking ... or even ignore it) and also how the library sends events...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found