Quarenta
Posts: 0
Joined: Tue Apr 15, 2014 12:36 pm

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hello. I created an app and followed the steps for retrieving the device ID and it worked. But i'm not sucessful on retrieving the device token, is returns "undefined".
First i attached to the "Device Ready" event and later to the "Push Initialize" and nothing happened.

Any help?

PS: I did followed the tutorials. I guess for me to test them right the token will be necessary don't?

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

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hello!

Could you clarify what tutorial you use? Does "Push Initialize" event works at all?

Quarenta
Posts: 0
Joined: Tue Apr 15, 2014 12:36 pm

"Undefined" when trying to retrieve push notification Token for my Smartphone

Ok. I started to follow this tutorial http://docs.appery.io/tutorials/sendi... , and when got to section "Sending push notifications", step 2, for me to select the devices, i suppose there has to be at least one registered, so i followed the link to the other tutorial "http://docs.appery.io/documentation/b..." but when got to the section "Obtaining deviceID and token", i wrote the code to retrieve the device id when got it, but being unable to retrieve the device token.

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

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hi,

You could run this code on Push initialize event, for example:presetTimeout(function() {
alert(localStorage.getItem('pushNotificationToken'));
}, 1);/pre

Quarenta
Posts: 0
Joined: Tue Apr 15, 2014 12:36 pm

"Undefined" when trying to retrieve push notification Token for my Smartphone

And i've done it.
See the image Image

And to refer that on iOS, neither the device id nor the token appears. On iOS i'm testing it via the appery.io tester, on my ipod touch.

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

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hello!

Please try to install app on device.

Quarenta
Posts: 0
Joined: Tue Apr 15, 2014 12:36 pm

"Undefined" when trying to retrieve push notification Token for my Smartphone

I only got it working installing the app on the device, and with the internet connected. I made a test by clearing the app data on the device, turning off the internet, and tried to retrieve the token, result: undefined.
I achieved the conclusion that the storage variable is only filled with the internet on, further then the value would be available.

On the other hand, the Appery.io Tester either on Android and iOS run apps but not with all capabilities than an installed app.

Thanks folks.

Quarenta
Posts: 0
Joined: Tue Apr 15, 2014 12:36 pm

"Undefined" when trying to retrieve push notification Token for my Smartphone

Please i got the token working, but i need a summary explanation of the steps to get the push notification working( this summary that i'm requesting is not on the tutorials so please help me, it's not laziness ).

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

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hello!

Please clarify what exactly doesn't work when you follow tutorial.

jaque
Posts: 0
Joined: Tue Oct 07, 2014 1:48 am

"Undefined" when trying to retrieve push notification Token for my Smartphone

Hi every one!!

I'm just reading the same tutorial that Quarentena refers and I get the same result
I tried installing on device like you suggest.
I have the deviceID but the alert about tokeID always says "undefined" so when I try to send the push notification I get this error:
"Sending push notification fail: argument cannot be null."
¿what more can I try?
Have a good day, thanks.

Return to “Issues”