"Undefined" when trying to retrieve push notification Token for my Smartphone
Hi Jaque,
Did you mistaken when write "tokeID" ?
Please show us your implementation screen shots.
Regards.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi Jaque,
Did you mistaken when write "tokeID" ?
Please show us your implementation screen shots.
Regards.
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):
Thank for the support. Have a nice day!
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.
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:
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!!
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:
but I don't know where these fields are defined...
In my Services/RESTService/Settings, I have defined it as this:
Is there anything incorrect with this approach?
Thanks!
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.
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
Please check my reply here: https://getsatisfaction.com/apperyio/...