Page 7 of 8

Trouble Sending Push Notifications

Posted: Wed Feb 10, 2016 7:45 pm
by Serhii Kulibaba

Please change it to:

alert(JSON.stringify(event));
it'll print all event's data, so you will be able to see parameters where message is


Trouble Sending Push Notifications

Posted: Thu Feb 11, 2016 12:57 am
by EJLD

Hi Sergiy, thks for your msg.

alert(JSON.stringify(event)

as you advised doesn't work on all devices:
. ok on motoG Android 5
. no alert pops up on Note3 Android 5

however, since it shows the all string on MotoG :

{"isTrusted":"false","notification":{"aps":{"alert":"myMsg"}}}

I could make the Note3 prompting the alert with the myMsg properly with the following code:

alert(JSON.stringify(event.notification.aps.alert));

back to motoG, it works well to

good team work ! :)
Eric


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 7:29 am
by EJLD

Hi there, I hv just upgraded from Cordova 3.7 to 4.1.1 to cope with the googlePlay notif.

I noticed that my code reading the notification msg doesn't work anymore.

any update ?

thks in advance
Eric


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 10:26 am
by Illya Stepanov

Hi Eric - Yes, it has been changed in libraries version 3.1

on the Push notification event try this JS code:
precode
alert(data.message);/code/pre


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 12:10 pm
by EJLD

Hi Illya, thank you for your prompt response. Let me try this soon. Hv a good Sunday evening, Eric


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 1:44 pm
by EJLD

Illya, good to know that. thks again.

I read a bit on the blog and found the following:
"Push Notification message
alert(data.message);
When the app is active and a Push Notification message arrives this event handle will be invoked and an alert will be shown. This is just a sample. In your app, you might want to invoke another action to process the notification."

Wld you be kind enough to tell me how (or where I can find) to remove this alert popping up at the middle of the window ?

thks in advance


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 1:55 pm
by EJLD

Illya,
in fact, even though I didn't insert any handler on push notif event, I do get the alert msg popping up. basically I don't want this alert at the middle of the window. any idea how to block this alert before it pops up ? thks in advance, Eric


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 2:09 pm
by Illya Stepanov

Sorry, I'm not sure that I'm getting your point here -- could you please illustrate what have you now in your app and what code you're using?


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 10:15 pm
by EJLD

Illya,
what I understood with the 3.1 library is that on incoming notification from another device, if the app is active on foreground, then an alert pops up by default.
however, as soon as some code are set on "push notif" event, this code will supersede the default alert. that's what I wanted to do.

nevertheless, still I must find how to read the notif message itself with code in order to take action on it. I could do before with previous library, and have to look for it again with 3.1.
any advice ?

Eric


Trouble Sending Push Notifications

Posted: Sun Aug 28, 2016 11:04 pm
by EJLD

Eventually, I found the way to read the notif event's message with
JSON.stringify(data.message);
looks easier to implement than before ... good job ! :)

however, it seems that even though the panel event handler is on a particular page, as soon as a notif comes in and the app is in the foreground with whatever page opened (different from the one having the panel event handler), then this notif panel event handler will be fired.

any reason to have such a broader scope ?
why don't this event handler is not only for the page ?

Eric