问题描述
如果我的应用程序关闭,点击通知栏后,回调不起作用.
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 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)