如何获得在Android的自有设备的手机号码?手机号码、如何获得、设备、Android

由网友(九江凉月)分享简介:我想中检索设备的手机号码编程。我的code为: - I want to retreive mobile number of device programatically. My code is:-TelephonyManager telephonyManager = (TelephonyManager)this....

我想中检索设备的手机号码编程。我的code为: -

I want to retreive mobile number of device programatically. My code is:-

TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String strMobileNumber = telephonyManager.getLine1Number();

和我已经设置 READ_PHONE_STATE 许可在AndroidManifest.xml文件。这是工作在仿真器,但在与闪电版本实际的设备,它返回空字符串。是否有任何其他的方式来获得手机号码?

and I have set READ_PHONE_STATE permission in AndroidManifest.xml file. This is working on emulator but on actual device with eclair version, it is returning empty string. Is there any other way to get mobile no?

推荐答案

有没有可靠的方法来retreive手机号码器件编程,AFAIK。 getLine1Number()报告由SIM卡的GSM手机提供的号码,手机号码并不需要是在SIM卡上。

There is no reliable way to "retreive mobile number of device programatically", AFAIK. getLine1Number() reports the number supplied by the SIM card for GSM phones, and the mobile number does not need to be on the SIM card.

阅读全文

相关推荐

最新文章