Page 4 of 6
read push device token
Posted: Mon Dec 02, 2013 3:58 pm
by laura6372139
Hi Maryna:
hello:
Is this right?
What code should I add?
Your what could explain me step by step.
I'm so sorry.
thanks
read push device token
Posted: Tue Dec 03, 2013 10:15 am
by laura6372139
I add in localstorge variable this code:
try {
var arr = JSON.parse(localStorage.getItem("savepush"));
if ({}.toString.call(arr) !== "[message]") {
alert("alert");
}
} catch ( e ) {
alert("Parse Error. e);
}
but I don't know to add "On Push Notification event add Run JavaScript action"
read push device token
Posted: Tue Dec 03, 2013 12:02 pm
by Maryna Brodina
read push device token
Posted: Tue Dec 03, 2013 12:16 pm
by laura6372139
read push device token
Posted: Tue Dec 03, 2013 1:27 pm
by Maryna Brodina
To save push message into localStorage variable add the following code on Push notification event:
prevar savedMessages;
try {
savedMessages = JSON.parse(localStorage.getItem("savedMessages"));
if ({}.toString.call(savedMessages) !== "[object Array]") {
savedMessages = [];
}
} catch ( e ) {
savedMessages = [];
}
savedMessages.push(data.aps.alert);
localStorage.setItem("savedMessages", JSON.stringify(savedMessages));/pre as a result you'll have array of messages as JSON string in localStorage variable.
read push device token
Posted: Tue Dec 03, 2013 6:26 pm
by laura6372139
Hi:
first I've added this code to my localstorage:
To read the local storage I have followed the manual:
http://docs.appery.io/tutorials/build...
But when I test my app:
This is not my last notification.
Code: Select all
Upgradeable? [url=https://d2r1vs3d9006ap.cloudfront.net/s3_images/993116/Captura.PNG?1386095357][img]https://d2r1vs3d9006ap.cloudfront.net/s3_images/993116/Captura_inline.PNG?1386095357[/img] [/url]
read push device token
Posted: Tue Dec 03, 2013 7:48 pm
by Kateryna Grynko
Hi Laura,
Could you please clarify, do you have problem with sending or receiving Push Notification?
read push device token
Posted: Tue Dec 03, 2013 8:42 pm
by laura6372139
hi katya:
I have no problems with sending notifications. It works very well.
I need to save the notifications in the screen that I send, so that I can read them after.
Thanks!
read push device token
Posted: Tue Dec 03, 2013 9:16 pm
by Kateryna Grynko
Laura,
Try this code please: prelocalStorage.setItem("message", JSON.stringify(data.aps.alert));/pre
read push device token
Posted: Wed Dec 04, 2013 9:37 am
by laura6372139
Hi:
I put that code in my variable "savedMessage" but it doesn't work!