Firebase onMessageReceived is not called when the application is killed

Firebase Cloud Messaging topics were discussed that the Data Payload message does not start from the method onMessageReceived()for some lower-level devices. And it is true. Here is the result:

Script of the application killed:

Devices received a data payload:

  • Nexus 5X: OS 7.1

Devices did not receive data payload:

  • Xiaomi MI 4C: OS 5.1
  • Huawei LUA-U22: OS 5.1

Make sure that I do not send a notification from the server / mail manager.

I'm looking for a solution, I got a payload from Firebase, including all types of devices, OS, and, obviously, from API level 15. My Postman data is as follows.

 {
    "registration_ids": ["fC5uxGSRCsg:APA91bHh9fMXQ41LpX6tjjSsBKGrKTWYpzKimLDzvBGSHDPo2pq87JHqogUp2kqrmJi06siG_p6DfgRCim23iFzlBQAIrgtMDqRW4s39zUqv9CzyPqzxVl5PtnHPRDs4OagTuTePNyDI"],
    "data": {
        "title" : "my_custom_value",
        "message" : "tekksdasdasdsa",
         "isBackground" : "",
          "payload" : {


          },
           "timestamp" : "",
            "imageUrl" : "",
     }

}
+4
2

MI , ! , !


Xiaomi , . , , .
: -
, , , , , !

+2

Firebase:

: . :

. .

. .

data​​strong > , . :

onMessageReceived , :

:, . . .

: Android . onMessageReceived(). : On Android, , .

: , . , .

, . - , ram , onMessageReceived() . . , . .

{
    "data": {
        "message": "message_body",
        "title": "message_title"
    },
    "notification": {
        "body": "message_body",
        "title": "message_title"
    }
}

.

+1

Source: https://habr.com/ru/post/1685648/


All Articles