Update:
As mentioned by op, the problem was fixed when using to the latest stable version (7.0.3). Then the cause is a bug in the new dev release.
Related GitHub issue, Link
Original Answer:
Judging by the issues that you described, the problem that you are running into might be because you are on the dev channel.
Did you try to use the latest stable? (7.0.3 at the time of writing). It might be a bug in the dev channel.
If the problem persists, try sending a data message instead of the notification message. This will stop firebase from sending a notification on the device. But be aware that you will have to display a notification manually. This way you will have control over the display of the notifications based on the screen and wouldn't have to keep the state in sync with the server as you were mentioning.
But this might not work on iOS since according to the docs, onMessage()
will be triggered when the app becomes in foreground.
Check the link above for more details on how the notification message and the data message gets handled on both Android and iOS.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…