应用程序关闭时,使用 FCM 的 Cordova 推送通知不起作用

问题描述

当应用程序处于前台/后台时,一切正常,我可以收到通知、其数据和导航。 当应用程序完全关闭时,我会收到通知,但当我点击它时,我被重定向到主页,data.wasTapped 没有被触发。这就像应用程序以初始模式打开,我希望它进入我发送的 data.confirm_page。 应用关闭noNotification 不起作用,有什么建议吗?

FCM:

FCM.onNotification(data => {
    if (data.wasTapped) {
        // should redirect to data.confirm_page
    },else {
        // displaying a pop message,when the user confirms it sends him/her to the specified route
    }
}

推送 API:

{
    "to": "fcm token","notification": {
        "title": "this is the title","body": "this is the body","click_action": "FCM_PLUGIN_ACTIVITY","icon": "notification_icon","iconColor": "#e73439"
    },"android": {
        "priority": "0"
    },"time_to_live_sec": 86400,"data": {
        "confirm_page": "/help","confirm_label": "OK","callback_data": {},"reject_label": "Cancel"
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)