开发者

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

开发者 https://www.devze.com 2023-02-14 11:32 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to fetch own mobile number in android
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

精彩评论

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

关注公众号