简体   繁体   English

如何在真实设备中获取电话号码

[英]how to get the telephone number in real device

i want to know get the number of device by telephoneManager and getLine1Number() ,it is workly well in analog machine,but in real device i donot get,could you tell me why? 我想知道通过电话管理器和getLine1Number()获取设备号,在模拟机中工作正常,但在真实设备中却没有,请问为什么?

in the com.android.internal.telephony inlude getLine1Number() ,how can use the inner class? 在com.android.internal.telephony中包含getLine1Number(),如何使用内部类?

This question has been asked and answered on SO a number of times. SO问题已经多次提出和回答。 The phone number is (possibly) stored on the SIM-card and you can get it with TelephonyManager.getLine1Number() however, it is not reliable. 电话号码(可能)存储在SIM卡上,您可以通过TelephonyManager.getLine1Number()获取TelephonyManager.getLine1Number()但是它并不可靠。 Some SIM cards don't have the phone number on them (in which case you will get null ) and if the user changes his phone number without swapping his SIM card then you will get his old phone number. 某些SIM卡上没有电话号码(在这种情况下,您将获得null ),如果用户在不交换SIM卡的情况下更改其电话号码,则您将获得其旧电话号码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM