I'm trying to get the signal strength of dual sims it works absolutely fine on most of the phones but for some phones (same android version [11] but different geographic location) the MNC code what we receive from subscriptionManager.getActiveSubscriptionInfoList() and telephonyManager.getAllCellInfo() does not matches.

I'm fetching the getAllCellInfo by following code

 ArrayList<CellInfo> allCellInfo = new ArrayList<>(telephonyManager.getAllCellInfo());

allCellInfo values are as follow

allCellInfo Size:6
 CellInfoLte:{mRegistered=YES mTimeStamp=76968972213907ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=483863 mPci=231 mTac=154 mEarfcn=38750 mBands=[] mBandwidth=2147483647 mMcc=405 mMnc=866 mAlphaLong=JIO 4G mAlphaShort=JIO 4G mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=2147483647 rsrp=-100 rsrq=-13 rssnr=0 cqi=2147483647 ta=6 level=2 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}
 CellInfoLte:{mRegistered=NO mTimeStamp=76968972213907ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=0 mPci=66 mTac=0 mEarfcn=38750 mBands=[] mBandwidth=2147483647 mMcc=null mMnc=null mAlphaLong= mAlphaShort= mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=2147483647 rsrp=-100 rsrq=-14 rssnr=0 cqi=0 ta=0 level=2 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}
 CellInfoLte:{mRegistered=YES mTimeStamp=76969000601292ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=109569537 mPci=0 mTac=9020 mEarfcn=1250 mBands=[] mBandwidth=2147483647 mMcc=405 mMnc=753 mAlphaLong=Vi India mAlphaShort=Vi India mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=-59 rsrp=-111 rsrq=-9 rssnr=-2 cqi=2147483647 ta=0 level=1 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}
 CellInfoLte:{mRegistered=NO mTimeStamp=76969000601292ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=0 mPci=67 mTac=0 mEarfcn=1250 mBands=[] mBandwidth=2147483647 mMcc=null mMnc=null mAlphaLong= mAlphaShort= mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=2147483647 rsrp=-111 rsrq=-16 rssnr=0 cqi=0 ta=0 level=1 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}
 CellInfoLte:{mRegistered=NO mTimeStamp=76969000601292ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=0 mPci=33 mTac=0 mEarfcn=1250 mBands=[] mBandwidth=2147483647 mMcc=null mMnc=null mAlphaLong= mAlphaShort= mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=-59 rsrp=-112 rsrq=-11 rssnr=0 cqi=0 ta=0 level=1 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}
 CellInfoLte:{mRegistered=NO mTimeStamp=76969000601292ns mCellConnectionStatus=0 CellIdentityLte:{ mCi=0 mPci=403 mTac=0 mEarfcn=1250 mBands=[] mBandwidth=2147483647 mMcc=null mMnc=null mAlphaLong= mAlphaShort= mAdditionalPlmns={} mCsgInfo=null} CellSignalStrengthLte: rssi=-59 rsrp=-117 rsrq=-16 rssnr=0 cqi=0 ta=0 level=0 parametersUseForLevel=0 android.telephony.CellConfigLte :{ isEndcAvailable = false }}

subscriptionManager.getActiveSubscriptionInfoList() is fetched like bellow

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
    subManager = (SubscriptionManager)context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
    activeSubscriptionInfoList = subManager.getActiveSubscriptionInfoList();
}

activeSubscriptionInfoList values are as follow

activeSubscriptionInfoList Size:2
 {id=2 iccId= simSlotIndex=0 carrierId=2018 displayName=Jio 4G carrierName=Jio 4G nameSource=0 iconTint=-13408298 number= dataRoaming=1 iconBitmap=android.graphics.Bitmap@58bcc24 mcc=405 mnc=856 countryIso=in isEmbedded=false nativeAccessRules=null cardString= cardId=1 isOpportunistic=false groupUUID=null isGroupDisabled=false profileClass=-1 ehplmns=null hplmns=null subscriptionType=0 groupOwner=null carrierConfigAccessRules=null areUiccApplicationsEnabled=true}
 {id=1 iccId= simSlotIndex=1 carrierId=1963 displayName=Vodafone IN carrierName=Vi India | Vodafone IN nameSource=1 iconTint=-16746133 number= dataRoaming=0 iconBitmap=android.graphics.Bitmap@c91138d mcc=405 mnc=67 countryIso=in isEmbedded=false nativeAccessRules=null cardString= cardId=0 isOpportunistic=false groupUUID=null isGroupDisabled=false profileClass=-1 ehplmns=null hplmns=null subscriptionType=0 groupOwner=null carrierConfigAccessRules=null areUiccApplicationsEnabled=true}

from above example you can see that I have two sim cards in the device which is fetched by the activeSubcriptionInfoList, with MNC 856 for simSlot 0 and MNC 67 for simSlot 1.

But you can clearly see that allCellInfo does not have MNC 856 and MNC 67, instead it has MNC 866 and MNC 753

How to solve this issue ? how to map the CellInfo list to simSlot 0 and SimSlot 1 with different MNC values ?

Thanks in Advance..

1

There are 1 answers

0
Mahesh Gouda On BEST ANSWER

I solved it by using the array index of cellinfo to map it to the simSlot 0/1,

created the new list of to store only the registered Cellinfo

ArrayList<CellInfo> registeredCellinfo = new ArrayList<>();
  for (CellInfo rcinfo : allCellInfo) {
    if (rcinfo.isRegistered()) {
       registeredCellinfo.add(rcinfo);
    }
 }

then to get the simSlot 0 / simSlot 1 CellInfomation im returning the registredCellInfo element at the specified simSlot, (registeredCellInfo elements are ordered, simSlot 0 information will be in the index 0)

 return registeredCellinfo.get(slotIndex);