当应用程序被完全终止时未收到FCM通知

问题描述 投票:2回答:1

我一直在尝试使用FCM发送推送通知。当应用程序处于前景或后台时,它可以完全正常工作。但是,如果我从最近的列表中删除了该应用程序,则不会收到任何通知。

This is my structure of FCM with data payload

{"registration_ids":["here is my FCM token"],
    "data":{
    "body" :"Hello All, Hope you had a great time!",
    "title":"Title",
    "click_action":"ACTIVITY_MESSAGE",
    "sound":"default",
    "type" : "message",
    "message": "message_here",
    "time" : "2016-12-14 03:37:pm"
  }
  } 

This is the structure with data and notification

{"registration_ids":["Here is my FCM token"],
  "notification":{
     "body" : "Hello All, Hope you had a great time!",
     "title":"title here",
     "click_action":"ACTIVITY_HOME",
     "sound":"default"
        },
  "data":{
     "type" : "message",
     "message": "message_here",
     "time" : "2016-12-14 03:37:pm"
}
}   

我也尝试过使用通知标签和数据进行相同操作,但是万一该应用被杀死,则无济于事。如果有人有任何想法,如果我的应用程序被杀死,我该如何获取通知,然后共享。

android firebase push-notification firebase-notifications
1个回答
0
投票

您应尝试将"forceStart": "1"放在数据括号内。这样,您应强制应用程序启动通知。

© www.soinside.com 2019 - 2024. All rights reserved.