开发者

How to get my phonenumber

I am looking for a way to get my phone number... the .getLine1Number() retur开发者_运维百科ns null, is there any alternative?


There could be several reasons...

Are you using an emulator? If so then it won't have an phone number

Are you using a tablet? Same as above

Have you added this permission in the manifest?

<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>

Are you using the correct code?

TelephonyManager mTelephonyMgr;
mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
mTelephonyMgr.getLine1Number();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜