Monday, November 24th, 2008 | Author: Tim

Something that you always come across in writing algorithms for devices that you want to lock down is getting a grasp of the actual device it is intended to be on. Sometimes programmers want to lock a registration code not only to a name for registration, but also to a device. This can cut down on “sharing” of serial numbers etc. I was doing some research and looking for device specific information when I stumbled upon a few things. They are right out there in the open, but here they are just in case you have not seen them yet.

In Android.Provider.Settings.System we have some interesting values that could be of use, one specifically is “Android_ID”. From the documentation it is the following;

String ANDROID_ID The Android ID (a unique 64-bit value) as a hex string. “android_id”

Though while this is considered a “unique key”, please keep in mind that if a program has write access to the Settings, which is possible, this could be changed easily. Though it could be a safe assuming that it should not be changed, and upon normal program usage it wouldn’t be changed. Anyway, to retrieve this ID you just use the following snip-it of code;

import Android.Provider.Settings.System;
...
String Android_ID = System.getString(this.getContentResolver(), System.ANDROID_ID);

Also, note that in an emulator this will return “null”, though a real device will return an actual value. The nice thing about this tid-bit of code is that you are not required any special permissions to call it, since it’s essentially a passive call to get information. No write access is (obviously) required.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

7 Responses

  1. It seems that your code is outdated. For some reason the line of code used to get the Android_id is not making any sense if copied into an IDE.

    Janusz

  1. [...] Wednesday, November 26th, 2008 | Author: Tim Previously I wrote about how to uniquely identify Android devices without special permissions. However, maybe you want to get into the nitty-gritty and get an even more unique identifier for [...]

  2. [...] with these values, combined with past values we’ve found both with special permissions and no special permissions, you should be able to hash something together for a unique [...]

  3. [...] This might cause your end users to question what your application is actually doing. If you don’t like this then you might like to consider using the system settings Android_ID as described at strazzere.com. [...]

  4. [...] Uniquely Identifying Android Devices without special permissions. http://strazzere.com/blog/?p=113 [...]

  5. [...] Uniquely Identifying Android Devices without special permissions. http://strazzere.com/blog/?p=113 [...]

  6. [...] noch nehmen k?nnte. Mit minimalem Aufwand bei google bisschen rumgesucht und was findet man da: strazzere.com Blog Archive Uniquely Identifying Android Devices without special permissions. Das sieht doch ziemlich gut aus: [...]

Leave a Reply