Eric,
First of all you should set up Push notifications, as told in tutorials, when you will receive one you should add this code and try to read message.
You should place this code on Load event,
Eric,
First of all you should set up Push notifications, as told in tutorials, when you will receive one you should add this code and try to read message.
You should place this code on Load event,
Alena ... don't take it wrong but I know all that. I hv been using pushNotif at many occasions either one-to-one device or to all devices using filters. however, this reading message functionality, I cldn't make it work based on your tuto. I'll check again but may come back to you
i m back ... I do receive the notif as usual but when opening the page where I placed the code nothing happens ???
sorry but nothing work. my app is on share. name collect4good
may I ask you to check quickly what is going wrong ?
html asset is "Friend115msgTxto"
you can test it under your login
appery
appery
8
looking forward to hearing from you soon
Eric
Actually it's supposed to act differently, message can be read on Push notification event, not just when page with code opened.
Try to add this code instead:
pre
$(document).on("push-notification", function(event, data) {
alert(JSON.stringify(data));
window.open(data.message, "_blank");
}); /pre
What do you get in alert message?
Alena, thks for your msg
understood how it works.
I had to change a little bit the code
the device reacts to
document.addEventListener("push-notification", function(event,data) {
alert(JSON.stringify(data));
});
how ever the alert message remains "undefined"
couldn't find how to retrieve the msg sent ?
any idea ?
best,
Eric
any advice to retrieve the message contents and read it ?
it would be help full to filter the incoming pushNotif message
thks in advance
hi there ? any advice?
Hello,
Please add this line to the "push-notification" event listener:
alert(event.notification);
Kindly let us know the result.
Hi Sergiy, thks for your msg. I tried but still unproper.
this time I got = [object Object]
before with alert(data.message), I got = undefined
we are are getting closer
looking forward to receiving something new from you
thks for your time
best
Eric