Notifications when app is closed

When my app is closed, or runs in the background, and I open a notification, it is not handled. In fact, it doesn’t even call the handler. (push.on('notification')) however, when I am inside the app, it works.

Normally, I initialise push handlers after the user is logged in (he doesn’t have to manually, server just verifies a token), but even if I set it exactly on platform.ready it still does

Any advice?

Which platform do you encounter this problem?
Are you sure that this is possible on that platform without additional work?

Android. On iOS it works perfectly as intended, but on Android, notifications from outside doesn’t work… (same code, pretty sure android should also work from outside)

I am not any more, that’s why I am asking :slight_smile:

See here for example: This is specific to FCM, but I assume the same was valid for GCM that you (and your push service) are probably still using. Looking into it, the relevant part for GCM was if the data was sent in “notification” or “data”:

Interesting that this isn’t better documented and known. (Or I’m just an idiot… possible)

That’s very interesting!
I am using FCM (using node fcm-push) and am sending my payload in data, and in notification I just send: title, tag, color, body, sound (not relevant app data, just notification thing)

Is that not good?
Not much to read on the subject…

As I read it you should decide if you want to use notification or data - and leave the other one out of the message to make sure it works as expected.



what was the fix? As i read your comments in git it was something with the payload?


When alarm time comes, a notification goes off, instead of the track it posibile??

How did you solved it. i am getting same issue. i am receiving notifications in iOS in all states(minimized,killed or closed, open). but in android i am able to receive notification when app is open and minimized but not receiving if app is killed or closed.

1 Like