How to get ANDROID_ID of an android device?
This tutorial explains how to get ANDROID_ID of android devices.
ANDROID_ID is a unique string that can be used to identify your device. Though there are many pros and cons of the same. Some properties of ANDROID_ID are :
1) This is a 64-bit quantity that is generated and stored when the device first boots.
2) It is reset when the device is wiped.
3) It is not 100% reliable on releases of Android prior to 2.2 (“Froyo”).
4) Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID.
So developers are adviced to use it keeping in mind all the above mentioned points.
The code below can be used to obtain ANDROID_ID :
String android_id = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID);