Possible Duplicate:
Is there a unique Android device ID?
I used below code to get android device IMEI and How can I change below code to get android device Unique ID.
String getDeviceID1(TelephonyManager phonyManager){
String id = phonyManager.getDeviceId();
if (id == null){
id = "not available";
}
int phoneType = phonyManager.getPhoneType();
switch(phoneType){
case TelephonyManager.PHONE_TYPE_NONE:
return "" + id;
case TelephonyManager.PHONE_TYPE_GSM:
return "" + id;
case TelephonyManager.PHONE_TYPE_CDMA:
return "" + id;
/*
* for API Level 11 or above
* case TelephonyManager.PHONE_TYPE_SIP:
* return "SIP";
*/
default:
return "" + id;
}
//I used to show IMEI
TextView textDeviceID = (TextView)findViewById(R.id.deviceid);
//retrieve a reference to an instance of TelephonyManager
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
textDeviceID.setText(getDeviceID1(telephonyManager));
}
Settings. Secure#ANDROID_ID returns the Android ID as an unique for each user 64-bit hex string. It's known to be null sometimes, it's documented as "can change upon factory reset". Use at your own risk, and it can be easily changed on a rooted phone.
A device ID is a unique, anonymized string of numbers and letters that identifies every individual smartphone or tablet in the world. It is stored on the mobile device and can be retrieved by any app that is downloaded and installed.
No, Device id remains constant.
Finding your device ID is straightforward whether you have an Android or an Apple device. For an Android enter “*#*#8255#*#*” into the keypad. As soon as you type the last digit the GTalk service monitor device will pop up where you will be able to see your device ID.
In Android, you can get three different Unique Ids.
IMEI ( which you have in your code already )
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String id = (getDeviceID1(telephonyManager));
Device ID
String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
Bluetooth Address ( this will also be unique for each device )
private BluetoothAdapter mBtAdapter;
// Get the local Bluetooth adapter
mBtAdapter = BluetoothAdapter.getDefaultAdapter();
String deviceMacAddress = mBtAdapter.getAddress();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With