简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM