How to get the telephone number associated with the SIM in a GSM phone?

7.7k views Asked by At

Possible Duplicate:
How to fetch own mobile number in android

How to get the telephone number associated with the SIM in a GSM phone?

1

There are 1 answers

4
ingsaurabh On BEST ANSWER

try following code

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

and with following permission in your xml

READ_PHONE_STATE