arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

Push notification not triggering when app is in background mode or closed IOS #955

Open umarrasheedmebest opened 5 years ago

umarrasheedmebest commented 5 years ago

Push notification triggering when the app in the foreground for IOS but unable to get the notification when app closed or goes into the background. I am using the firebase plugin in ionic. Can someone guide me to the right path? We are using AWS push notification for our backend. Thanks

mtayyabm770 commented 5 years ago

I am also having same problem, I face this problem in both IOS and my Huawei android mobile also. Any solution is welcome.

mtayyabm770 commented 5 years ago

@umarrasheedmebest, have you find the solution?

umarrasheedmebest commented 5 years ago

Still not found any solution

nzleesan commented 5 years ago

I am having same problem.. I try below url. but I have not solve..

https://github.com/arnesson/cordova-plugin-firebase/issues/888

scottlilo commented 5 years ago

I have finally found the solution after days of experimentation.

Fortunately, the issue is not with this library.

When construction the payload to Firebase, do not sent a Notification object, you must only send the data object.

If you send notification object then the notification is handled by google server process.

If you only send data object, without notification, then it will be handled by your application's NotificationService as expected.

Instead of

"notification":{ "title": "New Notification!", "body": "Test" }

Just send

"data":{ "title": "New Notification!", "body": "Test" },