Is it necessary background-mode for Push Notifications?

Hi!

I’m trying to display Push Notifications in one of my apps, It’s the first time that I doing this and I’m a little bit confusing about background-mode and push notifications dependency.

My apps will need to display different notifications according to their topics and I’m using Firebase.

I saw a thousand of examples which devs doesn’t use background-mode to display Push Notifications even when the app is in the background, so is necessary using background-mode or not?

Thanks in advance.

No, it is not necessary.

Thank you pliablepixels.

I was really confused about this.

Sorry keep asking about it, but is there any explanation about this? Push notifications behavior by default is a service in background?

This thread suggests otherwise. @pliablepixels care to elaborate on your answer?

1 Like

While the Ionic UI runs in the context of a web view, cordova plugins do not. PushPlugin is a cordova plugin and is implemented in native code. Ergo, whatever rules apply to how the target OS handles push notifications applies here. Its easiest to write code to test it out.

That being said, my interpretation of the OPs question was “does the app always need to run in the background for remote push notifications to be delivered to the device and/or app”. The answer to that question is no for device, and generally not for the app.

There are two aspects to remote notifications:
a) Does the OS receive it ? (so it can show in the notification tray/center) - it does, whether the app is running or not. When an app is removed, the registration is deleted, so the OS does not receive it

b) Does the app receive it ? Depends on whether you force killed it or not

See https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md - and the diagram - helps explain.

There are other nuances like silent notifications, notifications with content, background fetch modes etc. which you can read up on.

2 Likes

Cool, thanks for the clarification!