确切的解决方案"获取电话号码在Android和QUOT; [英] The exact solution of the "Get Phone Number in Android"

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

问题描述

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

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

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

不过,这并不正常工作。

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

的精确解

感谢的


解决方案

  

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

的精确解

让用户输入一个在的EditText ,或许与配置的android:inputType下=手机。中没有任何一种支持检索该设备的电话号码,该设备可能不知道其电话号码Android SDK中 - 仅在载体需要一个。此外,有几种情况,其中用户将需要以指示他们希望使用的可能的电话号码的


  • 双SIM卡手机

  • 人与其它电话号码移植到该设备​​,或者使用呼叫转移将呼叫路由到该设备

  • 人SIP号码或其他VOIP电话号码,他们preFER与设备
  • 来使用

I try to get my own phone number with this code

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

with

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

But it doesn't work regularly.

What is the exact solution of the "Get Phone Number in Android" ?

Thank's

解决方案

What is the exact solution of the "Get Phone Number in 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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆