1//first add this to mainfirst
2<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
3
4//and this in java
5TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
6telephonyManager.getDeviceId();