如果我的应用程序关闭,点击通知栏后,回调不起作用.
If my application is closed, after click to notification bar, the callback not working.
前台不错,后台不行.
我使用这个例子:https://ionicframework.com/docs/native/fcm/
我在 Andoird 上测试
I test on Andoird
谢谢
当应用程序处于后台以获取点击回调时,您可能需要更改发送到 FCM api 的通知和数据负载,如下所示.此处 click_action 应为 FCM_PLUGIN_ACTIVITY 以使点击正常工作.请参阅 fcm 插件文档中的发送通知.有效负载示例(REST API)"部分
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..."
}
这篇关于离子 2 在后台的 FCM 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!