使用 Android 从 SIM 中获取 MSISDN [英] Get MSISDN from the SIM using Android

查看:24
本文介绍了使用 Android 从 SIM 中获取 MSISDN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Android 从 SIM 中检索 MSISDN,我已尝试 getLine1Number() 但这只会返回存储在我的电话信息"或所有者信息"部分中的 MSISDN,如果这些信息是未存储,Android 将返回 null 值.

I'm trying to retrieve the MSISDN from the SIM using Android, I have tried getLine1Number() but this only returns the MSISDN stored in My Phone Information or Owner Information secction, if these info is not stored, Android will return a null value.

您知道解决此问题的任何方法吗?或者有没有办法从 SIM 号码 (getSimSerialNumber()) 中获取 MSISDN?

Do you know any work around from this? or is there a way to derive the MSISDN from the SIM number (getSimSerialNumber())?

一如既往地等待一个可靠的答案!:)

Awaits a solid Answer as always !!! :)

推荐答案

MSISDN(又名手机号码)不是 SIM 卡数据,因此无法检索.SIM 卡具有一个 IMSI(国际移动用户身份),该 IMSI(国际移动用户身份)被发送到负责映射 MSISDN/IMSI 的 HLR(归属位置寄存器).如果移动电话运营商愿意,他们可以将 MSISDN 存储在 SIM 卡上,但由于 GSM 协议不需要它.

The MSISDN (aka the mobile phone number) isn't a SIM data, so you can't retrieve it. The SIM card has an IMSI (International Mobile Subsriber Identity) that is sent to the HLR (Home Location Register) in charge of doing the mapping MSISDN/IMSI. Mobile phone operators could store the MSISDN on the SIM card if they wanted to, but since it is not required in the GSM protocol it isn't.

对不起!

有关更多信息,请查看此讨论获取电话号码 还有android如何获取MSISDN

For more info look at this discussion Getting phone number also How android get MSISDN

要获取IMSI号码,

 TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
 String imsi = mTelephonyMgr.getSubscriberId();

但有些手机只返回 6 位而不是 15 位.所以,您可以使用,

but a few handsets only return 6 digits instead of 15. So, you can use,

根据这篇文章:http://www.anddev.org/tinytut_-_getting_the_imsi_-_imei_sim-device_unique_ids-t446.html

String imei = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);

有关更多信息,请查看 此问题类 SystemProperties

For more info look at This Question and class SystemProperties

这篇关于使用 Android 从 SIM 中获取 MSISDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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