-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FirebaseMessagingService Custom notifcations/other tasks when app is in backgorund #8
Comments
@kaushikb1996 thanks for the feedback, you are right that this has confused a few people so far. I will pass it on to the team. |
This is expected behaviour, the behaviour has not changed between GCM and FCM. Notification messages only get handled by the receiver callback when the app is in the foreground. Otherwise the notification is sent to the notification center and if tapped any data sent along with the notification message will be available in the intent extras of the intent fired when the notification is tapped. The notification console always sends notification messages. +1 this is not called out enough so we will make an effort to make this more clear in our docs. Thanks for the feedback. |
@kroikie I firstly appreciate that you are taking our feedback seriously : ) I now know that this is the expected behavior but the issue is earlier in GCM I didn't even know that there was a console to send notifications but since your improved UI in firebase, creating notifications from console is very simple as a result I got confused and thought it was similar to testing with api, so more emphasis on the console itself would be really helpful especially for beginners. |
Hello , some time ago published in http://stackoverflow.com/questions/38020348/send-a-notification-background-firebase-android a problem that I have with the push notification in foreground and backgrand FCM after you read the link sugueris me to look at my app android? backgrand foreground and take different style. Regards, |
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 killedthat 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 apisand 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 FIX1) 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 problemHERE 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
The text was updated successfully, but these errors were encountered: