我要找回自己的手机号和IMEI。
I want to retrieve the own mobile number and the IMEI.
我如何从Android手机这些信息?
How do I get this information from the Android phone?
使用
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
String phone = tm.getLine1Number();
但它不是对例如非手机设备总是可靠的。您还需要添加permisionandroid.permission.READ_PHONE_STATE。
but its not always reliable on for example non phone device. You will also need to add permision "android.permission.READ_PHONE_STATE".