How to get IMEI number in Android
The code snippate below enables you get the IMEI number of any android device
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = telephonyManager.getDeviceId();
Log.d(TAG, "getDeviceId() " + deviceId);
Paste this piece of code in your activity and the monitor the logcat to see the IMEI number of the device. You can as well output this as a Toast.
Add this permission on the android manifest file
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Add this permission on the android manifest file
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
For this code to work you must test it with a real device.
0 comments:
Post a Comment