从android手机越来越IMSI? [英] getting IMSI from android phone?
问题描述
我开发一个应用程序,需要得到IMSI。我使用的:
I am developing an app that requires to get the IMSI. I use:
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
这适用于大多数的手机,但也有少数手机只返回6位而不是15这是错误的。
It works for most phones, but a few handsets only return 6 digits instead of 15. Which is wrong.
任何人都知道以编程方式检索IMSI的另一种方式?其他的API?方法?
Anyone knows an alternative way to retrieve the IMSI programatically? Other APIS? methods?
问候
推荐答案
根据这篇文章:<一个href="http://www.anddev.org/tinytut_-_getting_the_imsi_-_imei_sim-device_unique_ids-t446.html">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是不能直接访问的,所以你需要使用的招数,在回答这个问题一:的哪里是android.os.SystemProperties
该人士$ C $下类SystemProperties
这里:<一href="http://hi-android.info/src/android/os/SystemProperties.java.html">http://hi-android.info/src/android/os/SystemProperties.java.html
The source code for class SystemProperties
is here: http://hi-android.info/src/android/os/SystemProperties.java.html
这篇关于从android手机越来越IMSI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!