【问题标题】:Not getting FCM notification when app is completely killed应用程序完全被杀死时没有收到 FCM 通知
【发布时间】:2018-02-25 12:43:18
【问题描述】:

我一直在尝试使用 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】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-21
    • 2017-12-02
    • 1970-01-01
    相关资源
    最近更新 更多