getting access to deviceid
Is there a way I can get direct access to the device id via a JS variable? I would like to send it back via the REST Service.
PhoneGap seems to have this as device.uuid. Is it possible to access this?
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/
Is there a way I can get direct access to the device id via a JS variable? I would like to send it back via the REST Service.
PhoneGap seems to have this as device.uuid. Is it possible to access this?
Yes, every app you create in Appery.io includes PhoneGap: http://docs.appery.io/getting-started
Whether the device id and the token is automatically created by appery when 'device ready' event fires OR we need to do it manually? I read somewhere that it is automatically stored in local storage(both device is and token) by appery. Can you clarify?
Hello!
If you enable push notification for your app, deviceId will save automatically to appery's DB.
How can I retrieve those details. Where is the documentation for that?
Hello!
device id is set on device ready event and stored in localStorage variable "pushNotificationDeviceID".
You can retrieve it at any time after Device ready event.
prealert(localStorage.getItem('pushNotificationDeviceID'));/preif you need to retrieve device id on Device ready event use setTimeout function. For example run the following code on device ready event:
presetTimeout(function(){
alert(localStorage.getItem('pushNotificationDeviceID'))
}, 1);/pre
Two things...
Hello!
Please look at this documentation: http://docs.appery.io/documentation/b...
Nikita,
That documentation does not tell how to get the deviceID. In fact, it says that in order to get the deviceID you need to have the deviceID . Here is what it says:
pre
The get device service can be used for retrieving information about the device stored in the devices collection. The response of this service is JSON, which contains all predefined and user-defined fields of the devices collection. This service can be handy when you need to get the deviceID, check its timeZone, or any other operation involving device info.
To get device info from the database, send GET request with device id in the end of the associated URL:
https://api.appery.io/rest/push/reg/<deviceId>/pre
So, it says to get the deviceID I send a request which includes the deviceID. That documention is not very helpful.
However, Maryna's reply, above, is excellent.
prelocalStorage.getItem(pushNotificationDeviceID)/pre
fyi, PhoneGap API device.uuid only gives the ID after the semicolon.