TelephonyManager is not Providing Phone Number on Every Device

て烟熏妆下的殇ゞ 提交于 2019-12-11 08:36:17

问题


I need phone numbers while developing my application. So, I used TelephonyManager as seen below:

TelephonyManager tmgr =(TelephonyManager)getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE);
Log.d("Tag", tmgr.getLine1Number());

But when I tried application in different devices, somehow getLine1Number() not working. I mean returns NULL.

Permission is okay. Finally, does getLine1Number() depend on other requirements? Is it possible to learn phone number on every device.

Thanks for advices.


回答1:


it is not possible to get phone number on every device because this depends on how sim card is made. This is a sim card limitation.



来源:https://stackoverflow.com/questions/9484753/telephonymanager-is-not-providing-phone-number-on-every-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!