FCM with ionic 2 in background not working(离子 2 在后台的 FCM 无法正常工作)
问题描述
如果我的应用程序关闭,点击通知栏后,回调不起作用.
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 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:离子 2 在后台的 FCM 无法正常工作


- UITextView 内容插图 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- URL编码Swift iOS 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01