ISSUE FIXED
I have switched from gcm to firebase messaging and I regret it now.
I know it clearly states in documentation that Notifications delivered when your app is in the background. In this case, the notification is delivered to the device’s system tray.
A user click on a notification opens the app launcher by default.
But onMessageReceived is not called when the app is background or killed
that means i don't know when a messaged is received and cant really write code according to that
and since my application needs to perform other task when this messaged is received, I cant find a way to do it.
and Additional Information This is the from only the tests i conducted from the firebase console and not the apis
and please explain this a little more:
When you send a notification from the Firebase console and your app is in the background it cannot be customized.
If you want custom background notifications you should use the FCM API to send data messages to your app and handle them in the FirebaseMessagingService where you can decide how the notification should look.
ISSUE TO FIX
1) I WANT DO CREATE A CUSTOMIZED MESSAGE WITHOUT THE DATA FROM THE MESSAGE AND ALSO PERFORM OTHER THINGS WHEN I RECEIVE THE MESSAGE.
2) And if onMessageReceived is not called then what part of the service or method is called ?
3) Is moving back to GCM my only option ?
But the idea of it only sounds so bad.
Please fix this in the future release .
PS: I have read through the closed issue which still doesn't solve this problem
HERE IS THE PROBLEM AND SOLUTION
Problem
Switching from the old gcm to new FirebaseMessagingService i thought it would be good to test hence i created messages using firebase console and only found that when app is background my custom notification was not working and Firebase onMessageReceived not called when app in background
In SHORT SOLUTION
It happens only when sending messages through console of firebase and not the apis
Solution
I tried to create messages from the api and only then did i realize that the Firebase onMessageReceived not called when app in background issue happens only when creating messages from the Firebase Console and not when sent from API
PS: FIREBASE TEAM PLEASE CLEARLY MENTION THIS IN THE CONSOLE, SINCE MANY PEOPLE HAVE THE SAME QUESTION