Android ID: Uniquely Identify your users
It is always of interest to uniquely identify your users. On AT&T’s network, you can uniquely identify a user from the browser using the x-up-subno header. This unique string is tied to the users SIM and remains constant for the life of that user on the network. It is anonymous, and you can use it without any privacy concerns.
However, what if you are planning a multiplayer game on Android, or just want to store data on your server from each user? You need a way to uniquely ID your users, but do not want to invoke a browser session to grab the Subscriber ID. Android offers the Android ID, which is unique to a phone/SIM combination, but is similar to the Subscriber ID in that it is anonymous.
From the Android SDK:
A 64-bit number (as a hex string) that is randomly generated on the device’s first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
To obtain the Android_ID, you can use the code below:
String fred = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
The string fred now contains the users Android ID. It will look something like: 20014610963261cb