Open kenchu1178 opened 7 years ago
See Payload Example in the Readme section. Add "click_action":"FCM_PLUGIN_ACTIVITY" when sending message. Solved my Problem with Notifications received while in background or closed.
@bendspoons I'm curious, the Payload Example also mentions a sound key, but I haven't been able to get it to work. Have you?
THANKS, WORKING NOW
@jonathan-chin Yeah, sound works, but i didint do anything special for that. But be aware that you do not have to set the sound to true or sth like that, set it to "default" (as string)!
If you are familar with PHP, try https://github.com/Paragraph1/php-fcm for sending. I tried that Tool and it works perfect. (Now i wrote my own for my company cause we needed to many special features which arent included in many repos fpr fcm)
Example (shortened)
$note = new Notification($title, $body); $note->setClickAction('FCM_PLUGIN_ACTIVITY'); $note->setSound('default');
@bendspoons I'm using node-fcm and this is the payload I'm sending:
let message = {
to: token,
notification: {
tag: "new_messages",
title: `You have ${count} new message${count == 1 ? '' : 's'}`,
body: 'Click to read them!',
sound: 'default',
//badge: "100"
},
data: {
type: "chat"
},
collapse_key: "new_messages"
};
the sound flag is there and set to default but my phone doesn't do anything.
do you get vibration too?
Thanks! Should be pointed out a bit clearer in the docs I'd say, but works fine!
when app closed and in the background. push notification show in the bar. after taped it. app will show up and launch to start. but How can I get the notification in the app