Unique Device Identifier

229 views
Skip to first unread message

ST.RE

unread,
Jan 8, 2013, 12:35:24 PM1/8/13
to codenameone...@googlegroups.com
Is it possible to identify a device? I need an unique device id for my app to identify a device over multiple apps.

Thanks 

Shai Almog

unread,
Jan 8, 2013, 2:19:59 PM1/8/13
to codenameone...@googlegroups.com
There is a UDID getter in Display but it isn't guaranteed on all devices.
Preferences.get("DeviceId__$", (long)-1);

Should return a unique value while running on a device as long as you don't disable device registration. However, if registration failed this will return -1.

ST.RE

unread,
Jan 21, 2013, 3:31:05 PM1/21/13
to codenameone...@googlegroups.com
Hi Shai,

i tried three different things:
Display.getInstance().getMsisdn();  => is null on my iPhone (i don't know the result on Android)
Display.getInstance().getUdid(); => is a device id on my iPhone but null on an Android Device
Preferences.get("DeviceId__$", (long)-1); => is null on my iPhone (i don't know the result on Android). I don't disabled the device registration (where can i do that!?)

What options do i have for a working device id detection?

Thanks

Mikhail Zemlyanukha

unread,
Jan 21, 2013, 4:15:40 PM1/21/13
to codenameone...@googlegroups.com
Why just don't use UDID when MSISDN is empty?

By the way, on Android devices without cellular network MSISDN may be
empty too. As far as I know, on Android devices there is no regular
(legal API) way to find unique ID.

Mike
> --
> --
> You received this message because you are subscribed to the Google
> Groups "CodenameOne Discussions" group.
>
> For more information about Codename One please visit
> http://www.codenameone.com/
>
> To post to this group, send email to
> codenameone...@googlegroups.com
> To unsubscribe from this group, send email to
> codenameone-discu...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/codenameone-discussions?hl=en?hl=en
>
>
>

Shai Almog

unread,
Jan 22, 2013, 12:57:03 AM1/22/13
to codenameone...@googlegroups.com
I checked and it turns out we only keep our device id with pro users (for push support). I looked into fixing this for all users but its a bit tricky to do right now. Feel free to file an RFE on me and I will try to create something more robust.

Mikhail Zemlyanukha

unread,
Jan 22, 2013, 6:32:06 AM1/22/13
to codenameone...@googlegroups.com
Do you generate device id on server? Looks like the only possible solution...

Shai Almog

unread,
Jan 22, 2013, 1:17:04 PM1/22/13
to codenameone...@googlegroups.com
Yes, we generate in the server.
Reply all
Reply to author
Forward
0 new messages