tags:

views:

126

answers:

2
+1  Q: 

Unique device id

Hi, Is there any unique id on Android Mobile?? If it is then how many digit it has? How can I access that through my program??

Thanks Deepak

+3  A: 

check IMEI.

http://www.anddev.org/tinytut_-_getting_the_imsi_-_imei_sim-device_unique_ids-t446.html

Andy Lin
Just a note: I found out that the IMEI/IMSI can contain letters and may be longer than 15... just in case you store it in the database with predefined column length...It seems that android can be installed on devices which store unique device identifier in a different way/format...
WarrenFaith
+2  A: 

IMEI is dependent on the SIM card, which might be removed or transferred between phones. The ANDROID_ID is another unique string that is set when the device is first turned on. It might change after a factory reset, however. It is 64 bits and is represented as a hex string.

http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID

String unique_id = android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
Aaron C
Are you sure that IMEI is dependent on SIM Card? Because I think, IMEI is used by the GSM mobile phones. For the CDMA mobile phones this unique id is dependent on the mobile phones. Please clear my doubt.
Deepak
I stand corrected. I was confusing IMEI with IMSI. IMEI is dependent on the phone itself. I personally prefer the ANDROID_ID because it is a nice 64-bit hex string. For security and licensing operations, it is easier to do bit-wise operations on it so that you don't have a plain-text string sitting in your compiled code.
Aaron C
Aaron: We can make change in ANDROID_ID by making factory reseting. Is there way to handle Factory RESET??
Deepak
That is the big downside to using ANDROID_ID. You could just take the first 15 characters of the IMEI. On my phone this number was hexadecimal, but you should double check that all phones output in this format before you depend on it.
Aaron C