I want to know the device's SIM SERIAL NUMBER programmatically on Android.
After searching a lot over the internet I am stuck in getting DUAL SIM's(Second Slot) Serial Number for those devices targetting API < 22
For API > 22 :
I can get it using
SubscriptionInfo infoSim1 = sManager.getActiveSubscriptionInfoForSimSlotIndex(0);
SubscriptionInfo infoSim2 = sManager.getActiveSubscriptionInfoForSimSlotIndex(1);
For API < 22 :
Case 1 - Single SIM :
I can get it using
TelephonyManager.getSimSerialNumber()
Case 2 - Dual SIM :
Android does not provide any methods for this. However, we can get it using reflection if we know the exact predictionmethod. For example we can get the IMEI by this method:
telephonyInfo.imeiSIM1 = getDeviceIdBySlot(context, "getDeviceId", 0);
telephonyInfo.imeiSIM2 = getDeviceIdBySlot(context, "getDeviceId", 1);
Although it is vendor dependent or manufacturer dependent.
To get the SimSerialNumber i use -
telephonyInfo.imeiSIM1 = getDeviceIdBySlot(context, "getSimSerialNumber", 0);
telephonyInfo.imeiSIM2 = getDeviceIdBySlot(context, "getSimSerialNumber", 1);
I am unable to get the SIM SERIAL NUMBER.
I have searched the Internet but Unable to find a way for SSN.
Aucun commentaire:
Enregistrer un commentaire