Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to receive FCM push notifications when app is killed?

I am developing an e-mail app in which I want that the user will get a push notification as soon as they receive new email. And for that purpose I am using FCM. I have just tried push notifications using FCM by following this link: https://www.youtube.com/watch?v=XijS62iP1Xo&t=6s in order to test what features FCM provides. But the problem I face is that the device receives push notifications when app is either in foreground or background but it won't receive any push notifications when the app is closed (swipe or clear from the task manager). I don't know how to achieve this via FCM? I want to receive push notifications just like the WhatsApp and Facebook apps.

Every kind of help is appreciated. Thanks in advance.

like image 998
Iqraa Avatar asked Nov 20 '17 18:11

Iqraa


1 Answers

There are 2 types of push notifications: Data messages and Notification messages.

If you are using the Data messages you will be in charge of handling the received message and present a notification to the user (if needed of course). But in this case you might miss notifications when your app is closed.

If you are using Notification Messages, FCM is handling the message for you and directly displays a notification if the app is in background/closed.

Please see more here.

like image 133
Cata Avatar answered Oct 20 '22 01:10

Cata