1

Is there any way to view IMSI and ICCID numbers of my SIM-cards? I didn't find such menu neither in About-Status nor anywhere else.

1

There are APIs available which apps (like this) use to read SIM information. Looking for CLI solution (refer to this, this and this), we can get IMSI and ICCID with following commands respectively (up to Android 9):

~$ service call iphonesubinfo 7
~$ service call iphonesubinfo 10

* Codes depend on order of methods defined here, which may differ on different Android versions.
* For dual SIM device use code 8 and 11 instead and append i32 2 to command to get second SIM information.

Pass the output through following pipes to convert hexadecimal output to a good looking string:

... | grep -oE '[0-9a-f]{8} ' | while read hex; do echo -ne "\u${hex:4:4}\u${hex:0:4}"; done; echo

Terminal emulator apps usually don't have permission READ_PHONE_STATE (though you can grant manually with root) which is required by both functions. So commands need to be executed from adb shell.

Codes 7/8 correspond to getSubscriberId and 10/11 to getSimSerialNumber. However both methods have been removed for normal apps usage in Android 10. Only system apps with READ_PRIVILEGED_PHONE_STATE will be able to get this information. iphonesubinfo service can't be dumped with dumpsys either. So root is the only solution on Android 10+.

RIL may also log the operator/SIM related information to logcat when SIM state changes. With root access it's possible to read telephony database (the component of application framework which interfaces RIL) and also RIL database itself (which interfaces modem). On my Qualcomm device RILD stores information to /data/vendor/radio/qcril.db including ICCID and MCC/MNC.

~# sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select icc_id,card_id,carrier_name,display_name,mcc,mnc from siminfo'
~# sqlite3 /data/vendor/radio/qcril.db 'select ICCID from qcril_manual_prov_table'

As of Android 9 IMSI is also stored in /data/system/netpolicy.xml to set mobile data limits for MNOs separately.

~# grep -o 'subscriberId=[^ ]*' /data/system/netpolicy.xml

RELATED:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.