首页 文章

打开应用程序并屏幕锁定时,未收到离子FCM推送通知,除非它被点击

提问于
浏览
1

我正在开发一个离子应用程序,我正在使用FCM推送通知向用户发送通知 .

这是发送通知的JSON有效负载:

{
    "to" : "access_token",
    "priority": "normal",
    "notification" : {
      "body" : "this is message",
      "title" : "notification Title"
    },
    "data": {
          "link": ....
     }
}

在这些不同的情况下收到推送通知:

  • the app is in background or it is killed - >用户将收到系统托盘推送通知

  • the app is in foreground and the user is in it - >用户将收到将更新应用程序的新数据

  • the app is in foreground and the screen is locked (系统认为它在后台) - >因此用户将收到系统托盘推送通知,但在解锁手机屏幕时, nothing happens in the app instance that were in foreground 直到我点击系统托盘中的推送通知 .

有没有办法获取系统托盘中的推送通知数据而不点击它?

2 回答

  • 0

    希望这项工作!对于Foreground,您可以使用 Local Notification 显示推送通知:

    https://ionicframework.com/docs/native/local-notifications/

  • -1

    发送通知信息和数据对象,然后在您的离子项目中手动设置包含该数据的通知 .

相关问题