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

read push device token

Hello! Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.

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

read push device token

Hi Laura,

1) On page 'Notificaciones' remove service 'sendpush'
2) Create new REST service 'savedMessagesSrv' with the following settings:
Image Image
3) Add this service on page 'Notificaciones', name it as 'savedMessagesService': Image
4) On page 'Notificaciones' add a Grid with a cell and a Label in it.
5) Do the following mapping:Image
6) On Page Show event run the following code:prevar savedMessages;
try {
savedMessages = JSON.parse(localStorage.getItem("savedMessages"));
if ({}.toString.call(savedMessages) !== "[object Array]") {
savedMessages = [];
}
} catch ( e ) {
savedMessages = [];
}

savedMessagesSrv.requestOptions.echo = '{"messages": ' + JSON.stringify(savedMessages) + '}';
try {
savedMessagesService.execute({})
} catch (ex) {
console.log(ex.name + ' ' + ex.message);
hideSpinner();
};/pre
7) On Push notification event run the following code instead of current one:
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));
savedMessagesSrv.requestOptions.echo = '{"messages": ' + JSON.stringify(savedMessages) + '}';
try {
savedMessagesService.execute({})
} catch (ex) {
console.log(ex.name + ' ' + ex.message);
hideSpinner();
};/pre

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

read push device token

Hi:

I have followed step by step explanations, but it still does not work.

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

read push device token

Hello! Could you clarify what exactly doesn't work? You don't receive push notifications?

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

read push device token

Hi Maryna:

I send and receive push notifications perfectly.

But I need to save these notifications on a label in the screen.

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

read push device token

Hi Laura,

Please take a look at here: https://getsatisfaction.com/apperyio/...

irfan
Posts: 0
Joined: Sat Apr 26, 2014 7:54 am

read push device token

Image

I have done everything u tut but i still can save notification received on my app plzz help thanks

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

read push device token

Hello!

Please describe your problem in more details. Wgat have you done and what exactly doesn't work? How to reproduce your problem?

irfan
Posts: 0
Joined: Sat Apr 26, 2014 7:54 am

read push device token

Good Day Maryna!

Hope you are good today

My Target?
I am trying to read received push notifications inside my app (once i click on oush notification from notification bar from phone it should open up in a page and show me received push message i just received.)

What i have achieved so far
i can send notification from server to my phone(android) work great following ur tutoria.

i have attached the screen shorts above for the ur concerns all the services i added mapping aja Json script.

Thanks

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

read push device token

Hi Ifran,

Could you clarify what code do you run to save message? On what event?
What tutorial did you follow?

Return to “Issues”