appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
544 stars 125 forks source link

Push notifications in Android only work when PhoneGap app is in foreground #135

Closed pmkruyen closed 4 years ago

pmkruyen commented 4 years ago

Hi all,

Thanks for this amazing module.

For iOS devices everything works as expected, but for Android push notifications are only received when the app is in foreground.

I just asked a question about this behavior on StackOverflow. But then I realized it might be better to pose the question here.

Any help is appreciated.

Thanks, Peter

PS. When I am right about this, I would like to suggest to add a small comment to the set-up file that explains that the gcm id refers to the Firebase server key.

alex-friedl commented 4 years ago

@pmkruyen sorry for the late reply. Not sure if you got any further with this in the meantime. I assume you are using for the phonegap-push-plugin for your app? The behaviour for Android of this plugin is described in https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#android-behaviour. It is recommended by the author to use a data only notification payload, which should also make the notification appear in the system tray when the app is in the background.

alex-friedl commented 4 years ago

Please re-open if there are any further questions