I've been trying to get notifications by airship for my app. It worked with the iOS fine, but with Android, there are some issues.
In the first I was getting a warning whenever I send a notification saying:
No task registered for key ReactNativeFirebaseMessagingHeadlessTask
I searched for some answer and finally I added these lines to my code:
messaging()
.setBackgroundMessageHandler(async (remoteMessage) => {
console.log('Message handled in the background!', remoteMessage);
});
It kind of works now but displaying the notification still doesn't work. Now when I receive the notification I get this log from the above function:
Message handled in the background!,
{
"data": {
"com.urbanairship.metadata": "eyJ2ZXJzaW9uX2lkIjoxLCJ0aW1lIjoxNjM2NDcxNzk3MjgyLCJwdXNoX2lkIjoiZDczN2QxZWMtNTExNC00NWI3LThhNGYtYjI1NWNmYWZiZDcxIiwiY2FtcGFpZ25zIjp7ImNhdGVnb3JpZXMiOltdfX0=",
"com.urbanairship.push.ALERT": "Congratulations! You've successfully configured Android Push.",
"com.urbanairship.push.APID": "26e8cdec-3e61-437c-940d-cd9e75c3a7df",
"com.urbanairship.push.CANONICAL_PUSH_ID": "d737d1ec-5114-45b7-8a4f-b255cfafbd71",
"com.urbanairship.push.PUSH_ID": "e51fd020-4171-11ec-a035-02423b27e6fe"
},
"from": "827761845713",
"messageId": "0:1636471797306222%14a7377ff9fd7ecd",
"sentTime": 1636471797292,
"ttl": 2419200
}
It's clearly received the notification without any error from the phone or the platform (it says sent successfully), but it still won't show up in the phone.
The problem is located in the AndroidManifest.xml file. I removed this and everything works now.