My backend is sending Data-Only message, below shows the payload when app is in the Background state. And I'm relying Firebase messaging()
to receive the payload.
{
aps = {
alert = {
body = "msg";
title = iOS;
};
sound = default;
};
deeplink = "myapp://profile";
"gcm.message_id" = maskedData;
"google.c.a.e" = 1;
"google.c.sender.id" = maskedData;
mediaType = image;
notificationid = "maskedData";
}
For now, my method setBackgroundMessageHandler
is not called when the banner (notification) kicks in when app is in Background/Kill state. This happened because my payload does not contain contentAvailable: true
I guess.
Although my app will show the banner still but no code is run behind the scene.
Meaning if the user decides to open my app without tapping the banner, I’m unable to store the notification content hence user will never see it in app. Unless he opens the app via the banner (notification), my app gets the notification content. Hence I’m able to do certain processing behind (storing content, append into my notification list)..
My questions:
- How can we wakes the app and does certain processing (store content, etc) as soon as notification banner is received?
- How can we update Badge number when app is in Background/Kill stated? (I planned to do it via the “behind process” as well when notification is received. But for now, I don’t get notify until user taps the banner)
Of course, here goes my version @react-native-firebase/messaging": "^7.8.4",