发送通知背景 Firebase android

Send a Notification Background Firebase android

运行: 发送 https://fcm.googleapis.com/fcm/send

{
  "to" : "xxxxxxxxxxxxxxxxxxxxxxxxx",   
  "priority" : "normal",
   "time_to_live" : 3,
  "notification" : {
    "body" : " test mensaje",
    "color":"#FF2301",
    "icon" : "ic_logo_noti_mini",
    "sound":"notificacion.mp3",
    "title" : "Notification ",
    "click_action" : "OPEN_ACTIVITY_1"
  },
   "data" : {
      "url_fiori" : "http://www.goole.com.ar"
    }
}

如果应用程序打开,消息以正确的格式到达。 如果 APP 是 cerra 消息以错误的格式到达,它不会通过扩展 FirebaseMessagingService 的 class 逻辑。

我需要做的是在关闭应用程序之前获取消息 FCM background simpre open format。

可能是什么问题?

此致,

问题已解决:

如果我们正在使用FCM并且我们希望从SOAPUI,SAP,PI等发送消息并且该消息被前台或后台接收为APP并且样式始终相同则只能使用"data"。 通过 onMessageReceived 方法传递。

{ "data": {
"Title": "Firebase notification"
"Detail": "I am firebase notification."
  },
  "To": "efaOvIXDbik: APA91bEkNUVWNaoA ...."
  }

如果我们使用 "notification" 消息,无论应用程序处于前台还是后台,它们都会有所不同

{
"To": "bk3RNwTe3H0: CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1 ..."

"Notification": {
   "Body": "great match!"
   "Title": "Portugal vs. Denmark"
   "Icon": "MyIcon"
   "Sound": "mySound"
}

}