Khalid Taha Khalid Taha - 3 months ago 11
Android Question

Android Get Phone SIM number

How can I get The SIM card number using code ??
I tried this code and it returned no number

TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();

Answer

use

TelephonyManager phoneManager = (TelephonyManager) 
getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = phoneManager.getLine1Number();

Needs READ_PHONE_STATE permission.