Page 2 of 2

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

Posted: Tue Oct 07, 2014 10:36 pm
by Yurii Orishchuk

Hi Jaque,

Did you mistaken when write "tokeID" ?

Please show us your implementation screen shots.

Regards.


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

Posted: Tue Oct 07, 2014 11:45 pm
by jaque

Hi Yurii.

In order to accomplish the push notification tutorial from: http://devcenter.appery.io/documentat...

I set up the event at "device ready" it looks like this (for the push notification token):
Image

Thank for the support. Have a nice day!


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

Posted: Thu Oct 09, 2014 1:23 am
by Yurii Orishchuk

He Jaque,

Check whether you have correct values in fields "Sender ID" and "API Key". http://prntscr.com/4udvj9/direct

Also please use following code instead:

pre

setTimeout(function() {
alert(localStorage.getItem('pushNotificationToken'));
}, 1000);

/pre

Regards.


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

Posted: Wed Oct 22, 2014 4:35 am
by Jon Haider

I'm having the exact same trouble. Followed the Sending push notifications to a device tutorial. Then it directs you to the Push Notifications tutorial. Here, you are told to create events upon device ready to obtain the pushNotificationDeviceID and the pushNotificationToken. I created the event, on Device Ready, to run this script:
pre
setTimeout(function() {
alert(localStorage.getItem('pushNotificationDeviceID'));
}, 1);

setTimeout(function() {
alert(localStorage.getItem('pushNotificationToken'));
}, 1);
/pre
as seen here:
Image

I exported to .ipa, installed on my iphone 5s, and upon launching the app I get the deviceID. The database "Devices" collection is updated with my device and I can see the deviceID match what's on my iPhone screen.
Then the alert for the token comes up, and the value is "undefined" which is also how it appears in the "Devices" collection. So of course, when I try to send a push notification, and I go to Scheduled Push Notifications, I can see the error that the token only has 9 characters ("undefined") instead of the needed 64 or something.

How were others able to resolve this? Or did they stop responding because they gave up? lol

Thanks!!


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

Posted: Wed Oct 22, 2014 2:20 pm
by Jon Haider

It looks like this issue came up here and here, without there being a clear resolution. I've followed all of the recommendations made in those threads as well, but nothing helped.
:)
I've noticed that others are defining the database URL and database ID differently than what I'm finding. Previous posts show this:

Image

but I don't know where these fields are defined...

In my Services/RESTService/Settings, I have defined it as this:
Image

Is there anything incorrect with this approach?
Thanks!


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

Posted: Thu Oct 23, 2014 1:08 am
by Yurii Orishchuk

Hi Jon,

Please use suggested code:

pre

setTimeout(function() {
alert(localStorage.getItem('pushNotificationDeviceID'));
alert(localStorage.getItem('pushNotificationToken'));
}, 1000);

/pre

Also please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. We will take a look.

Regards.


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

Posted: Mon Jul 06, 2015 8:34 am
by Anim

I am facing the same problem and also row in my device collection is automatically deleted if I try to send notification and refresh device collection.

I followed the tutorial and it worked fine for my test app when when I trying to implement this I am facing this error


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

Posted: Mon Jul 06, 2015 10:23 pm
by Illya Stepanov

Please check my reply here: https://getsatisfaction.com/apperyio/...