Firebase Cloud Messaging Notification Not Received by Device

Firebase cloud messaging notification not received by device

You have placed your service outside the application tag. Change bottom to this.

<service
android:name=".NotificationGenie">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>

</application>

Firebase Cloud Messaging : not receiving message in android 12

For the new people who may come to this issue, I had the exact same issue :

In my case, I was still using Firebase library 17.x with the old deprecated architecture.

As now I updated into the firebase dependency into version 23.0.4, it worked just fine.

Firebase Cloud Messaging Notification not received in web app

That message does not indicate an error. It's just a warning letting you know that outbound networking does not work if your project is not on a payment plan. FCM messaging does not fall in this category - it should work.

The problem is that your code doesn't return a promise that resolves after all asynchronous work is complete. Right now, it returns nothing, and the function terminates immediately before the message is sent. Please read and understand the documentation about this.

Minimally, you will need to return the promise chain to let Cloud Functions know when the message is sent, and it's safe to terminate.

          return admin.messaging().sendMulticast(message)
.then((response) => {
// Response is a message ID string.
console.log(response.successCount + ' messages were sent successfully');
})
.catch((error) => {
console.log('Error sending message:', error);
});

Note the return keyword above.

If the message still isn't being sent, then there is some other problem here that we can't see. You might not be handling your device tokens correctly.



Related Topics



Leave a reply



Submit