使用Android从SIM卡取得MSISDN [英] Get MSISDN from the SIM using Android

查看:183
本文介绍了使用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卡具有发送到负责进行映射 MSISDN / IMSI 的HLR(归属位置寄存器)的IMSI(国际移动子载体身份)。
如果移动电话运营商想要将MSISDN存储在SIM卡上,但是由于GSM协议不需要MSISDN,所以不是。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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