我一直在尝试使用FCM发送推送通知。当应用程序处于Foreground或后台时,它完全有效。但是,如果我从最近的列表中删除该应用程序,那么我没有收到任何通知。
This is my structure of FCM with data payload
{"registration_ids":["here is my FCM token"],
"data":{
"body" :"Hello All, Hope you had a great time!",
"title":"Title",
"click_action":"ACTIVITY_MESSAGE",
"sound":"default",
"type" : "message",
"message": "message_here",
"time" : "2016-12-14 03:37:pm"
}
}
This is the structure with data and notification
{"registration_ids":["Here is my FCM token"],
"notification":{
"body" : "Hello All, Hope you had a great time!",
"title":"title here",
"click_action":"ACTIVITY_HOME",
"sound":"default"
},
"data":{
"type" : "message",
"message": "message_here",
"time" : "2016-12-14 03:37:pm"
}
}
我也尝试过同样的通知标签和数据,但是当应用程序被杀死时没有任何工作。如果有人知道如何在我的应用程序被杀死的情况下获得通知,那么请分享。
答案 0 :(得分:0)
您应该尝试将Type 'false' is not assignable
放在数据括号内。
这样,您应该强制应用程序启动通知。