开发者

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

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to fetch own mobile number in android

How to get the telephone n开发者_如何学Cumber associated with the SIM in a GSM phone?


try following code

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

and with following permission in your xml

READ_PHONE_STATE
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜