I want to retrieve the own mobile number and the IMEI.
How do I get this information from the Android phone?
use
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
String phone = tm.getLine1Number();
but its not always reliable on for example non phone device.
and you should also add this following permission to your AndroidManifest.xml
file
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
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