How to get notification in notification bar on device when it receives the notification as foreground

I am using the plugin with cordova-plugin-with-dependecy-updated.
But the notification is shown on notification bar when the app is in background or closed.
I wanna to get the notification in regardless the app is in foreground or background

Which plugin are you using?


Looking through the plugin docs,

It appears that foreground apps won’t show the notification bar as that is not how they things work.
It doesn’t appear that showing a notification bar in the foreground will be possible.

1 Like

It means that there is no way to get notification in notification bar on the device ?

When the app is in the foreground, there is no way to show a notification in the notification bar.
The plugin expects you to handle this by showing some sort of UI.

1 Like

you actually can get the notification data even if the app is in foreground. But it will not show a notification in your notification bar.
If you have subscribed to fcm.onNotification() function, catch the data in the else block below.

this.fcm.onNotification().subscribe((payload) => {

      console.log('onNotification received event with: ', payload);

      if (payload.wasTapped) {

        console.log("Received in background -> ", JSON.stringify(payload));

      } else {

        console.log("Received in foreground -> ", JSON.stringify(payload));



If you still want to show a notification in the notification tray, use local notification plugin. (I have not tested that yet tho)