mehtashail
Posts: 0
Joined: Tue Feb 04, 2014 1:29 am

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

getting access to deviceid

Yes, every app you create in Appery.io includes PhoneGap: http://docs.appery.io/getting-started

http://docs.phonegap.com/en/3.3.0/cor...

Joseph Joy Manadan
Posts: 0
Joined: Sat Mar 01, 2014 5:05 pm

getting access to deviceid

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?

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

getting access to deviceid

Hello!

If you enable push notification for your app, deviceId will save automatically to appery's DB.

Joseph Joy Manadan
Posts: 0
Joined: Sat Mar 01, 2014 5:05 pm

getting access to deviceid

How can I retrieve those details. Where is the documentation for that?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

getting access to deviceid

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

Joseph Joy Manadan
Posts: 0
Joined: Sat Mar 01, 2014 5:05 pm

getting access to deviceid

Two things...

  1. Where can I find the orginal documentation for all those you just mentioned?
  2. What about token? How to retrieve it?
Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

getting access to deviceid

Hello!

Please look at this documentation: http://docs.appery.io/documentation/b...

Fred McIntyre
Posts: 0
Joined: Sun Jan 12, 2014 5:04 pm

getting access to deviceid

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:&#47;&#47;api&#46;appery&#46;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&#46;getItem(pushNotificationDeviceID)/pre

fyi, PhoneGap API device.uuid only gives the ID after the semicolon.

Return to “Issues”