Ionic capacitor notifications

I have an ionic capacitor app that needs to receive notifications from the server and, as soon as the notifications are received, show a couple of buttons like ‘ok’ or ‘cancel’ to the user. I am new to mobile and ionic development, so any suggestions would be more than welcome.

  1. following the ionic notifications tutorial (https://capacitor.ionicframework.com/docs/guides/push-notifications-firebase/) I created an Android app that receives notifications. I noticed that if the app is in foreground, the notification is received directly from the app. If the app is in background or killed, the notification is received from the system and only when the user taps the notification, the notification is received from the app. Is it possible to make the app receive directly the notification when the app is in background or killed, too?

  2. may I directly receive a notification with some actions (i.e. buttons ‘ok’ and ‘cancel’)? Or should the app first receive the notification and then create a new notification to the user with the two buttons?

I learnt that what I really need is a data message. Upon receival of the data message, I can create a local notification.

1 Like

Can you please provide an example, how to achieve that in ionic capacitor. I am also struggling with the same issue for the last 2 days. This particular answer actually making sense. But how to achieve it in ionic capacitor?