Get my phone number in android

后端 未结 6 927
时光说笑
时光说笑 2020-11-27 15:03

How can I get my phone number in Android? When I use:

TelephonyManager tMgr =(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String mPhon         


        
6条回答
  •  温柔的废话
    2020-11-27 15:37

    From the documentation:

    Returns the phone number string for line 1, for example, the MSISDN for a GSM phone. Return null if it is unavailable.

    So you have done everything right, but there is no phone number stored.

    If you get null, you could display something to get the user to input the phone number on his/her own.

提交回复
热议问题