问题描述
我正在尝试使用 Android 从 SIM 卡中检索 MSISDN,我尝试过 getLine1Number() 但这只返回存储在我的电话信息或所有者信息部分中的 MSISDN,如果这些信息是未存储,Android 将返回空值.
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(国际移动用户标识),它被发送到 HLR(归属位置寄存器),负责进行映射MSISDN/IMSI.如果移动电话运营商愿意,他们可以将 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 号码,
To get IMSI number,
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!