getLine1Number 返回 null 但并不总是返回
我使用 TelephonyManager
来获取电话号码,在 SDK 中一切正常,在某些设备上,例如我的英雄,1.5 它返回 null,在纹身上 1.6 它可以工作,但在其他一些纹身上它返回空。
还有其他方法可以获取电话号码吗?
I use the TelephonyManager
to get the phone number, in the SDK all works perfectly, on some devices like my hero with 1.5 it returns null, on the tattoo with 1.6 it works but on some other tattoos it returns null.
Is there any other way to get the phone number?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,返回的电话号码是SIM卡MSISDN上存储的任何内容,一些运营商没有填写。 (更糟糕的是,根据一些报告,这个数字实际上可能不正确!)
不幸的是,我也不知道还有其他方法。
As far as I know, the phone number returned is whatever is stored on the SIM card's MSISDN, which isn't filled by some operators. (Worse still, according to some reports, the number might actually be incorrect!)
Unfortunately, I don't know of any other method, either.
我针对这个问题进行了很多搜索,但没有找到任何解决方案。
有一种解决方案是读取短信或从某些服务器发送短信。
I searched a lot for this problem and didn't find any solution.
There is a solution of reading SMS or sending SMS from some server.
解决方案是将 SIM 卡放入哑手机(或 2009 年之前的任何黑莓手机)中,然后设置 MSISDN。我认为对于黑莓你可以手动设置它们。
尝试在关闭收音机的情况下拨打##000000,然后编辑黑莓手机上显示的菜单中的第一行。
The solution is to put the SIM card in a dumb phone (or any Blackberry pre-2009) and the MSISDN will be set. I think with Blackberries you can manually set them.
Try dial ##000000 with the radio off and edit the first line in the menu that shows up on the Blackberry.