Page 1 of 2
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Tue Apr 15, 2014 3:46 pm
by Quarenta
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?
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Tue Apr 15, 2014 6:04 pm
by Maryna Brodina
Hello!
Could you clarify what tutorial you use? Does "Push Initialize" event works at all?
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Wed Apr 16, 2014 8:40 am
by Quarenta
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.
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Wed Apr 16, 2014 1:10 pm
by Kateryna Grynko
Hi,
You could run this code on Push initialize event, for example:presetTimeout(function() {
alert(localStorage.getItem('pushNotificationToken'));
}, 1);/pre
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Wed Apr 16, 2014 1:56 pm
by Quarenta
And i've done it.
See the 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.
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Wed Apr 16, 2014 4:03 pm
by Maryna Brodina
Hello!
Please try to install app on device.
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Thu Apr 17, 2014 2:22 pm
by Quarenta
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.
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Thu Apr 17, 2014 2:44 pm
by Quarenta
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 ).
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Thu Apr 17, 2014 5:19 pm
by Maryna Brodina
Hello!
Please clarify what exactly doesn't work when you follow tutorial.
"Undefined" when trying to retrieve push notification Token for my Smartphone
Posted: Tue Oct 07, 2014 1:48 am
by jaque
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.