应用程式被杀死时,是否有可能收到FCM推送通知? [英] Is it possible to receive FCM push notification when app is killed?

查看:592
本文介绍了应用程式被杀死时,是否有可能收到FCM推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个电子邮件应用程序,我希望用户在收到新电子邮件后立即收到推送通知.为此,我正在使用FCM.我通过以下链接尝试使用fcm进行推送通知: https://www. youtube.com/watch?v=XijS62iP1Xo&t=6s ,以便测试fcm提供的功能.但是我面临的问题是,当应用程序处于前台或后台时,设备会收到推送通知,但是在应用程序关闭时(从任务管理器中滑动或清除)它将不会收到任何推送通知.我不知道如何通过fcm实现这一目标?我想像whatsApp和Facebook一样接收推送通知.

I am developing an e-mail app in which I want that the user will get 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 device recieve push notification when app is either in foreground or background but it wont receive any push notifications when app is closed (Swipe or clear from the task manager). I dont know how to achieve this via fcm? I want to receive push notifications just like whatsApp and facebook.

我们非常感谢您提供的各种帮助.预先感谢.

Every kind of help is appreciated. Thanks in advance.

推荐答案

推送通知有两种类型:数据消息通知消息.

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.

如果您使用的是 Notification Messages (通知消息),则FCM会为您处理消息,并且如果应用程序处于后台/关闭状态,则直接显示通知.

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.

这篇关于应用程式被杀死时,是否有可能收到FCM推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆