I have htc one b model android phone. I want to know my device ID. I do not know how could I finding out my device ID .
Try this :
String deviceId = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
Toast.makeText(this, deviceId, Toast.LENGTH_SHORT).show();
android.provider.Settings.Secure.ANDROID_ID
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.
Source Link : http://blog.vogella.com/2011/04/11/android-unique-identifier/
Note : The value may change if a factory reset is performed on the device.
Try this:
TelephonyManager TM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// IMEI No.
String imeiNo = TM.getDeviceId();
// IMSI No.
String imsiNo = TM.getSubscriberId();
// SIM Serial No.
String simSerialNo = TM.getSimSerialNumber();
// Android Unique ID
String androidId = Settings.Secure.getString(this.getContentResolver(),Settings.Secure.ANDROID_ID);
Don't forget to add
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
to your manifest file.
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