Issue
How can I get the ICCID number of the phone?
I looked in the TelephonyManager class, but didn’t found there a way to get the ICCID number, there is only a method which tells if the ICC card is present.
Solution
I believe getSimSerialNumber()
will get iccid.
UPDATE for Android 5.1 (credit Erick M Sprengel)
“Multiple SIM Card Support” was added for Android 5.1 (API 22). Instead of using getSimSerialNumber
, you can use SubscriptionManager
.
SubscriptionManager sm SubscriptionManager.from(mContext);
// it returns a list with a SubscriptionInfo instance for each simcard
// there is other methods to retrieve SubscriptionInfos (see [2])
List<SubscriptionInfo> sis sm.getActiveSubscriptionInfoList();
// getting first SubscriptionInfo
SubscriptionInfo si sis.get(0);
// getting iccId
String iccId si.getIccId();
You will need the permission: (credit Damian)
<uses-permission android:name"android.permission.READ_PHONE_STATE" />
Answered By – Reed