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
Unity - OnMessageReceived provides "null" notification when app in background #80
Comments
Yep this is currently the expected behavior. From https://firebase.google.com/docs/cloud-messaging/android/receive#handling_messages Messages with both notification and data payload, both background and foreground. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity. Also, see https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages Essentially the intent for the notification component is simply to be displayed to the user where the data is where you can add a payload for your app to process. You receive the notification when the app is in the foreground so that you can pop up the notification in whatever way you want. |
Have the same issue. In my case, I will receive an image url in data and I have to show a Notification with big image using that. I want to invoke that inside onMessageRefceived. But here I am not able to do that. Is there a work around to this ? |
The same issue, , how to detect message is received from clicked on push notification? |
Sorry guys, I don't know what to say: I've just re-tested my project and the sample project (both in 2019.1.2.f1) and now everything works fine. OnMessageReceived is called in background and foreground with the custom payload. I'm 100% sure that my previous tests were correct (I took notes because I was getting crazy) so I can only suppose that one needs to wait a while until Firebase sets everything right in its platform. I also deleted my previous comments, sorry for that. |
Hi,
I'm using the Unity code with an Android app. When the app is running in foreground the notification is properly received, OnMessageReceived is called and the e.Message.Notification is proper. When the application is in background, or not running, then a notification appears in the Android tray, but when clicked - the application opens and OnMessageReceived is called with e.Message.Notification == null.
Is this the proper behaviour? Should e.Message.Notification become "null" in the app callback when opened from tray?
The text was updated successfully, but these errors were encountered: