Android Question Unique device ID (again)

KMatle

Expert
Licensed User
Longtime User
Hi guys,

there are several threads about creating a reliable unique device id.

My first thought was: Why not take the MAC address of the Wifi AND the BT adapter? (assuming that almost any device has both). Maybe add the IMEI, too if it's a phone. At least 2 of the 3.

From my point of view that should be more than enough to create a unique id. The other threads take other data linke sim serial and/or phone number (if available), too but I think then it's not about the device (a sim card f.e. is not part of "the device").

What do you think?
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi guys,

there are several threads about creating a reliable unique device id.

My first thought was: Why not take the MAC address of the Wifi AND the BT adapter? (assuming that almost any device has both). Maybe add the IMEI, too if it's a phone. At least 2 of the 3.

From my point of view that should be more than enough to create a unique id. The other threads take other data linke sim serial and/or phone number (if available), too but I think then it's not about the device (a sim card f.e. is not part of "the device").

What do you think?
I think every device does have a unique ID. I have some inline Java code that will extract it. Maybe I am wrong but from what I understand is that is ID is unique. Does android devices have a central database where unique ID's are kept/allocated? Does someone know?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
combine mac with ticks to hex or something. chances are kind of none existing to get the same combo on another device.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Johan,

I have real devices that just have 123456789 as id. you can't really trust that.
That is interesting.....and that is supposed to be the unique ID of those devices?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I found this article, linked by this other one.
And a few words about Android O identifiers.
In my old lib dgUID I collected all the methods available at that time, but sadly none was 100% accurate..

udg
 
Last edited:
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
So can we do a survey of Unique ID's on the forum and see how many doubles we get? Just using code to extract the unique ID of everyone's device? Or is that too big a security risk?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Nice try ;-)
This is an extract for a b4a project that I was playing around with. Amongst others supposed to extract the Unique Android ID. See what you get with your various devices. It logs the ID to the B4A log.

It uses inline Java code so the JavaObject library must be enabled. I have not found any "predictable" ID's on any of my 6 devices.
 

Attachments

  • b4aDeviceUniqueID.zip
    7.4 KB · Views: 590
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Here is another version that logs the Android ID and a PseudoUniqueID....
 

Attachments

  • b4aDeviceUniqueID.zip
    8.1 KB · Views: 545
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
So is the PseudoUniqueID also just a "?"...
I do confirm

sc.png
 
Last edited:
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
It seems not so easy (as we all experienced it) to get a unique ID. I took a look at my own device and found that HERE Maps does store a text file which includes a line composed by a 5 group of numbers and letters, in its data folder (/data/package_name/files/.here-maps/uniqueDeviceId.txt)

I think that if it would be a simpler solution, a big company like that would have used it :)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I think that if it would be a simpler solution, a big company like that would have used it :)
or maybe it is the fact the a company like this ended in this solution (collecting 5 numbers) to find a reasonable unique id....
I´m using Phone.GetSettings("android_id") and for me it does work so far....
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
Since it is about the same topic I opted to continue here...

I am working with android boxes, and the market is full of chinese ones and I use Device ID to identify the app for configuration purpose.

In my case several vendors are now sending with r.GetStaticField("android.os.Build", "SERIAL") returning "0123456789abcdef"

Before that I had such problem but then I when occurred I switched automatically to the MAC address...

However they are now sending with this same Device ID and mac address always "02:00:00:00:00:00"

SO, No mac and no Device id to be based. I am using a GUID that I generate when the application is first installed and I keep it. At least I can find the configurations of that equipment.

I am curious if there is another option that I could use. I am not looking for security reasons, but for configuration retrieval from a server. As far as I know Android Boxes does now have MEI, and most of them does not have bluetooth either.

Any clue appreciated. Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I am using a GUID that I generate when the application is first installed and I keep it. At least I can find the configurations of that equipment.
Sounds like the best option. You can save it in File.DirRootExternal to make sure that it is not deleted if the app is uninstalled.
 
Upvote 0
Top