anthony
anthony

Reputation: 7733

Android: Notif push (FCM) doesn't receive properly when App is in background

I've updated from 'com.google.firebase:firebase-messaging:10.2.4' to '10.2.6', and since all notification push receive when my App is in background, don't catch in onMessageReceived().

On the official documentation (https://firebase.google.com/support/release-notes/android) I don't see informations about this.

Ps: in 10.2.4, all worked perfectly.

Could you help guys?

Upvotes: 1

Views: 194

Answers (1)

Eugen Pechanec
Eugen Pechanec

Reputation: 38243

If you want to receive the onMessageReceived in all cases you cannot use notification push messages. You can only use data payload in your FCM messages.

onMessageReceived is provided for most message types, with the following exceptions:

Notification messages delivered when your app is in the background. In this case, the notification is delivered to the device’s system tray. A user tap on a notification opens the app launcher by default.

Messages with both notification and data payload, both background and foreground. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.

Source: https://firebase.google.com/docs/cloud-messaging/android/receive

Upvotes: 0

Related Questions