Push Notification not showing in Android Notifications tray

I’m using the Capacitor Push Notifications plugin for the first time (migrating an Ionic 3 app to Ionic 5 - the old app uses the Cordova Push Plugin). I’m running the app directly from Android studio and moving it into background. I can see from the console that the push notification is received by the app but nothing appears in the device notification tray. I’ve checked settings and notifications are correctly set for the app.

Anyone have any ideas why the notifications are not appearing in the tray?

1 Like

I tried some Test Push Notifications from the Firebase Console and they worked ok so I think this must be because my server is sending Data Messages and not Notification Messages. This would imply that the Cordova Push Plug-in (used in our Ionic 3 app) processes these Data Messages a little differently (they appear in the Notification Tray)?

I am experiencing exactly the same behaviour.

iOS push notifications work exactly as expected.

Ionic CLI : 6.11.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.2.3
@angular-devkit/build-angular : 0.901.11
@angular-devkit/schematics : 9.1.9
@angular/cli : 9.1.11
@ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 2.4.0
@capacitor/core : 2.4.0

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v12.18.3 (/usr/local/Cellar/node@12/12.18.3/bin/node)
npm : 6.14.8
OS : macOS Catalina

Have you tried a test notification from the FCM console?

I was running into this recently for an android device. Make sure the message your sending has a notification property with a title and body inside of it like so:

{
  "message":{
    "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "notification":{
      "title":"Portugal vs. Denmark",
      "body":"great match!"
    }
  }
}
2 Likes

We’re using AWS as a messaging broker and have tried many tests. All tests arrive if the app is open, but nothing in the notification tray.

This turned out to be my issue. Missing “notification” property. Thanks for pointing me in the right direction.

2 Likes

I have a PWA that I added Android push notifications to and found that the data section needs to contain the “click_action” otherwise the click_action wouldn’t work in Android?

Here is an example push that seems to work for Android. Unfortunately, my PWA push no longer works, and I haven’t found out why yet.

{
“notification”: {
“title”: “6 Android User”,
“body”: “6 This is a message 3 sent to an Geoff Android device”,
“vibrate”: [200, 100, 300],
“icon”: “/assets/img/icon-1.png”
},
“data”: {
“body” : “great match everyone!”,
“title” : “What a match”,
“content_available” : true,
“priority” : “high”,
“click_action” : “/tabs/closures”
},
“to”: “Users_Id”
}