-
Notifications
You must be signed in to change notification settings - Fork 681
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
[android] heads-up notification #46
Comments
haven't experimented with this yet. let me try |
opened a ticket to fcm. will keep you updated |
@evollu did you happen to see this? We may have to key on no popup will occur if the app is in the foreground either, only background |
no. the didReceiveNotification...withHandler is enough. |
Noted and thanks @evollu |
i send only data, head up notification works fine in foreground and background status |
what is your payload. what platform? |
for android only:
|
This works well! |
Is this still working? Because when I try the above payload I get Error: Messaging payload contains an invalid value for the "data.custom_notification" property. Values must be strings. I have tried switching everything to strings and it still says this.
Is custom_notification still valid? It looks like it is not working anymore. |
Same issue for me... says that "data.custom_notification" isn't valid. |
Looking through the source code, I see this:
Looks like it may need to just be a JSON string... will try |
Hey I saw this too just yesterday. I think part of my problem was that I was using admin.messaging to send notifications and it does not allow nested objects. However I might try your idea about json.stringify on the nested object. I noticed yesterday in the example code (FirebaseClient.j) that there is a whole other method for sending notifications using fetch and http. This method implements json.stringify on the payload, are you using this method or admin.messaging?
|
Firebase should stringify nested object itself automatically. |
Hey @evollu I spoke to firebase support and they said this:
So they seem to think nested objects have never been supported. I was using admin.messaging to send my payload. I also wasn't JSON.stringifying the payload. Could this be the issue? |
Just tried to JSON.stringify the payload with admin.messaging() and can confirm that it does not work. |
OK I can confirm that this does work still but only with fetch send function in the example. It does not work with admin.messaging. Here is what I am doing:
Here is my payload:
|
@rtman Just getting back to trying it out, but I don't think you'd stringify the entire payload, just the I am using |
So you did this?
|
No. Just the value of |
Ah ok I see now. Any thoughts on which is better to use? Admin messaging or fetch? Sent from my Google Nexus 5 using FastHub |
Functionally the same (as far as I know), but if you are using typescript, the |
Cool, I have noticed that the fetch is reliably much faster to show a notification too. I wonder how it will work with offline situations when I implement that in the future, but I'll cross that bridge when I get to it! Sent from my Google Nexus 5 using FastHub |
How to show heads-up notification on android?
I am using the following payload from fcm.
The text was updated successfully, but these errors were encountered: