Reputation: 473
okay, I just want to make sure, is FCM onMessageReceived won't be called when app quit (not in background) ?
My notification work when both app is running and app is in background, but it's not work when app quit(swipe form running apps).
{
"data": {
"title": "Title",
"body": "Body",
"icon": "myicon",
"priority": "high"
},
"notification": {
"title": "Title",
"body": "Body",
"icon": "myicon",
"priority": "high"
},
"registration_ids": [some_ids]
}
Upvotes: 1
Views: 1577
Reputation: 4754
There are two types of fcm messages - Data messages and Notification messages.
Data messages(contains data paylaods) are handled in onMessageReceived whether the app is in the foreground or background.
Notification messages are only received in onMessageReceived when the app is in the foreground.
Messages containing both notification and data payloads are treated as notification messages. They will be automatically delivered on system tray by the system.
Upvotes: 1
Reputation: 6499
There is no issue, because fcm service itself in background, after swipe from running apps, you just wifi disable/enabled then your fcm will work
You will get notifications,just i check working as per expectations
Upvotes: 0