Skip to content Skip to sidebar Skip to footer

Firebase Message Service Not Called But One Time Only

I'm using firebase message service to get notification to my android app but the service not called but once! how to handle it to make it called whenever I got message? here is my

Solution 1:

The way you are sending notification your onMessageReceived() will not be called when your app is in background or killed to solve this issue remove notification field while sending notification and send only data like this

{ data:{ from_user: from_user_id // you can add more field if you want } };

include "priority": "high" filed in your notification request so that you will get the notification asap for more detail check this answer

Solution 2:

After way too much digging, I've realised that

The notification is delivered to the device's system tray, and the data payload is delivered in the extras of the intent of my launcher Activity.

So I was supposed to handle the extras from the activity in which I was sending the notification to. The answer was in here

Therefore, there was no need to write any code inside the onMessageReceived().

Thanks a bunch for you All. Really appreciate it

Post a Comment for "Firebase Message Service Not Called But One Time Only"