Firebase Notification Works Even With No Service Or Inherited Class?
Solution 1:
Just read the documentation.
...
Ok, let's go: there are three kind of "notification" using Firebase: notification messages, data messages and messages with both notification and data. Each is received and handled differently by the system. Here you can see more information about message types (how there are built).
There are handled like that:
- Notification message
- App in foreground:
onMessageReceived
's implementation - App in background: system tray (system dispatch automatically notification) -> with or without service implementation (maybe your case, without code I can't know)
- App in foreground:
- Data message
- App in foreground:
onMessageReceived
's implementation - App in background:
onMessageReceived
's implementation
- App in foreground:
- Message with both notification and data
- App in foreground:
onMessageReceived
's implementation - App in background: system tray (notification) and in extras of the intent (data)
- App in foreground:
But without any code or notification information, I can't continue to help you. Until you provide some code example, I only think that you send a notification message, and so system automatically display a notification and there is no call to the service's onMessageReceived
, it's normal.
If you want to "control" and decide if notification should be shown or not, just send data messages, and in your onMessageReceived
implementation, create a notification with content and intent and notify it to the system (if you want it to be shown).
Post a Comment for "Firebase Notification Works Even With No Service Or Inherited Class?"