获取电话号码在Android和QUOT

获取电话号码在Android和QUOT

本文介绍了确切的解决方案"获取电话号码在Android和QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我自己的电话号码与此code

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

 <使用许可权的android:NAME =android.permission.READ_PHONE_STATE/>

不过,这并不正常工作。

什么是Android中获取电话号码?

的精确解

感谢的


解决方案

Have the user enter one in an EditText, perhaps configured with android:inputType="phone". There is nothing in the Android SDK that supports retrieving the device's phone number, as the device may not know its phone number -- only the carrier needs that. Moreover, there are several scenarios in which the user would need to indicate which of the possible phone numbers they wish to use:

  • dual-SIM phones
  • people with other phone numbers ported to this device, or using call-forwarding to route calls to this devices
  • people with SIP numbers or other VOIP phone numbers they prefer to use with the device

这篇关于确切的解决方案"获取电话号码在Android和QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 01:37