Page 1 of 1

Getting device ID is killing app?

Posted: Tue Sep 17, 2013 8:19 pm
by Nathanael

I am attempting to run the following JavaScript when app's start page loads:

codealert(PushNotification.getDeviceUniqueIdentifier());/code

Annnddd.... now my app isn't loading. I just get a spinning AJAX wheel that never goes away. The test app works fine without that line, and does not have any services or other custom JavaScript.

Is that code outdated? It's what the documentation says I should use to get a device ID.

Thanks!


Getting device ID is killing app?

Posted: Tue Sep 17, 2013 9:04 pm
by Maryna Brodina

Hello! This is because this variable is not defined when you run this code. You don't need to run this code to retrieve device id, it's stored in pushNotificationDeviceID localStorage. You can retrieve it from localStorage.


Getting device ID is killing app?

Posted: Wed Sep 18, 2013 2:59 pm
by Nathanael

Thanks for the response!

Unfortunately, it's still not quite working.

codealert(localStorage.getItem('pushNotificationDeviceID'));/code
^ this is returning a null alert message.


Getting device ID is killing app?

Posted: Wed Sep 18, 2013 5:38 pm
by Maryna Brodina

Hello! What event you use to run this code? Please try Device Ready event and the following code:
presetTimeout(function(){alert(localStorage.getItem('pushNotificationDeviceID'))}, 1);/pre


Getting device ID is killing app?

Posted: Wed Sep 18, 2013 7:46 pm
by Nathanael

Hmm, that looks like it's working. Thanks. :) Before, I had it on the page's load event without a timeout.

You're awesome, Marina!