当应用程序被杀时推送不被接收 [英] Push not received when app is killed
问题描述
{
to我使用新的FCM将消息从我的服务器推送到我的android应用程序。 :APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx ...,
data:{
Nick:Mario,
Room:PortugalVSDenmark
}
}
我可以使用新的FCM将消息推送到我的应用程序,但是当我杀死应用程序时(长按主页按钮然后滑动应用程序到左边),推送消息不会再交付。
为什么?解决方案检查原始有效负载,从服务器接收到的内容。 body
和标题
键必须在通知
键下有当应用程序关闭时得到推送通知。虽然您只会在应用关闭时收到通知托盘中的通知。示例有效载荷:
{
to:APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx ...,
通知:{
身体:伟大的比赛!,
标题:葡萄牙对丹麦,
图标:myicon
},
data:{
Nick:Mario,
Room:PortugalVSDenmark
}
}
I am using the new FCM to push message from my server to my android app.
{ "to" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...", "data" : { "Nick" : "Mario", "Room" : "PortugalVSDenmark" } }
I am able to push messages to my app using the new FCM however, when I kill the app (long press on home button then slide the app to the left), push messages are not delivered any more.
Why?
Check the raw payload, what is received from server. body
and title
key have to have under notification
key to get push-notification when app is closed. Though you'll only get notifications in notification tray when app is closed. Sample payload :
{
"to" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}
}
这篇关于当应用程序被杀时推送不被接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!