Skip to content Skip to sidebar Skip to footer

Onmessagereceived Not Fired If Application In Background

I've been developing android apps for a while now and all of them have FCM integrated in them and functioning properly. I have this app that the onMessageReceived isn't fired unles

Solution 1:

Using Firebase, you can send two type of notifications message basically.

1. Notification messages : sometimes thought of as "display messages."

2. Data/Payload messages : which are handled by the client app.

both above Notification has different behaviour, depending upon if your app is in foreground or background.

1.Notification msg + Background : delivered to the notification tray

2.Notification msg + Foreground : onMessageReceived() on Android

3.Data msg + Background : apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification.

4.Data msg + Foreground : your app receives a message object with both payloads available.

For more clarification check this.

For sending Data/payload message using FCM console use Advance option and insert key and value.

enter image description here

Post a Comment for "Onmessagereceived Not Fired If Application In Background"