FCM shows default message than custom message when app is not running

前端 未结 2 714
时光说笑
时光说笑 2020-12-12 06:01

Problem: My FCM code shows different messages to different cases:

Case 1: When app is running it shows the custom notification body

Case 2:

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 06:23

    From the document

    When app is in foreground the onMessageReceived always calls.

    When app is in background the onMessageReceived will be called when the payload only has the data property (it doesn't exist the notification property).

    Hope it helps!

提交回复
热议问题