FCM与离子2在背景不起作用 [英] FCM with ionic 2 in background not working
问题描述
我使用这个例子: https://ionicframework.com/docs/native/fcm/
我在Andoird上测试
谢谢 解决方案
当应用程序在后台,以获得点击回拨你可能需要改变通知和数据有效载荷发送到FCM api如下。这里的click_action应该是FCM_PLUGIN_ACTIVITY,以便点击正常工作。请参阅 fcm插件文档中的发送通知。有效负载示例(REST API)部分。 >
{
notification:{
title:title,
body:message,
sound:default,
click_action:FCM_PLUGIN_ACTIVITY
},
data:{
title:title,
body:message,
param1:value1,
param2:value2
},
转换为:令牌...
}
If my application is closed, after click to notification bar, the callback not working.
It's good in foreground, but not in background.
I use this exemple : https://ionicframework.com/docs/native/fcm/
I test on Andoird
Thanks
When app is in background in order to get the click call back you might need to change the notification and data payload sending to the FCM api as below. Here the click_action should be FCM_PLUGIN_ACTIVITY in order to get the click to work properly. Refer the "Send notification. Payload example (REST API)" part in the fcm plugin documentation
{
"notification":{
"title":"title",
"body":"message",
"sound":"default",
"click_action":"FCM_PLUGIN_ACTIVITY"
},
"data":{
"title":"title",
"body":"message",
"param1":"value1",
"param2":"value2"
},
"to":"token..."
}
这篇关于FCM与离子2在背景不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!