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.
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 !!! :)
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.
Sorry!
For more info look at this discussion Getting phone number also How android get MSISDN
EDIT:
To get IMSI number,
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
but a few handsets only return 6 digits instead of 15. So, you can use,
According to this post: 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);
For more info look at This Question and class SystemProperties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With