laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

Hi Maryna:

Image

hello:

Is this right?

What code should I add?

Your what could explain me step by step.

I'm so sorry.

thanks

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

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"

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

read push device token

Hello! Working on it.

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

Thank you!!!!!!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

read push device token

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.

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

Hi:

first I've added this code to my localstorage:

Image

To read the local storage I have followed the manual:

http://docs.appery.io/tutorials/build...

But when I test my app:

Image

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]
Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

read push device token

Hi Laura,

Could you please clarify, do you have problem with sending or receiving Push Notification?

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

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!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

read push device token

Laura,

Try this code please: prelocalStorage.setItem("message", JSON.stringify(data.aps.alert));/pre

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

read push device token

Hi:

I put that code in my variable "savedMessage" but it doesn't work!

Return to “Issues”