Diego Güizzo Diego Güizzo - 1 year ago 135
Android Question

Send a Notification Background Firebase android

the run:
send https://fcm.googleapis.com/fcm/send

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

If the APP is open the message arrives in the correct format.
If the APP is cerra the message arrives in the wrong format, it does not pass through the logic of the class that extends FirebaseMessagingService.

enter image description here

I'd have to do to get the message FCM background simpre open format by more than the app is closed.

What could be the problem?


Answer Source

Problem solved:

If we are using FCM and we want the message sent from SOAPUI, SAP, PI, etc and that the message is received by the foreground or background being APP and the style is always the same is to be used only "data". Passeth by the method onMessageReceived.

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

If we use "notification" messages they are going to be different if the app is in foreground or background

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download