我正在接收fcm通知,但是在关闭应用程序时不会触发onNotification或.wasTapped。
当我在应用程序关闭状态下点击通知时,它将带我进入应用程序启动页面,但是我想在单击(点击)通知时打开特定页面。 我浏览了一个链接,其中显示关闭应用程序后,fcm通知会发送到设备的系统托盘。 链接https://firebase.google.com/docs/cloud-messaging/android/receive
如何通过fcm通知轻按重定向到Ionic 4中的特定页面?
下面是用于同一代码的代码
*import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic';
FCM.onNotification().subscribe(data => {
if(data.wasTapped)
{
this.router.navigate(["newsfeed",data["id"]])
}
});*
我正在从邮递员发送POST req(https://fcm.googleapis.com/fcm/send),以触发FCM通知服务器将通知发送到我的移动设备。 将其发送到体内
{
"notification":{
"title":"Stepping Up for Frontline Healthcare Providers",
"body":"When he is not designing software solutions for Ko…er this year, Herron saw it up close... read more",
"sound":"default",
"click_action":"FCM_PLUGIN_ACTIVITY",
"icon":"fcm_push_icon"
},
"data" : {
"id": 2,
"title": "Stepping Up for Frontline Healthcare Providers",
"description": "When he is not designing software solutions for Ko…er this year, Herron saw it up close... read more",
"imageUrl": "https://news.kochind.com/getattachment/ccd876b1-0dd0-4caf-9538-9cab93a9594f/attachment.aspx",
"contentLink": "https://news.kochind.com/news/2020/stepping-up-for-frontline-healthcare-providers"
},
"to":"c8_wpG3BAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"priority":"high"
}
[从以上链接截取的屏幕截图] [1]:https://i.stack.imgur.com/9lusY.png
[邮递员屏幕截图] [1]:https://i.stack.imgur.com/URYuV.png