Firebase Message Service Not Called But One Time Only
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"