Firebase onMessageReceived not called when app in background

前端 未结 26 3367
粉色の甜心
粉色の甜心 2020-11-22 02:32

I\'m working with Firebase and testing sending notifications to my app from my server while the app is in the background. The notification is sent successfully, it even appe

26条回答
  •  终归单人心
    2020-11-22 03:05

    There are 2 types of Firebase push-notifications:

    1- Notification message(Display message) -> -- 1.1 If you choose this variant, the OS will create it self a notification if app is in Background and will pass the data in the intent. Then it's up to the client to handle this data.

    -- 1.2 If the app is in Foreground then the notification it will be received via callback-function in the FirebaseMessagingService and it's up to the client to handle it.

    2- Data messages(up to 4k data) -> These messages are used to send only data to the client(silently) and it's up to the client to handle it for both cases background/foreground via callback-function in FirebaseMessagingService

    This is according official docs:https://firebase.google.com/docs/cloud-messaging/concept-options

提交回复
热议问题