//SubscriptionManager detection incoming number slot
SubscriptionManager mLocationManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
final List<SubscriptionInfo> activeSubscriptionInfoList = mLocationManager.getActiveSubscriptionInfoList();
int simCount = activeSubscriptionInfoList.size();
// btnBack.setText(simCount+" Sim available");
Log.d("MainActivity: ","simCount:" +simCount);
for (SubscriptionInfo subscriptionInfo : activeSubscriptionInfoList) {
Log.d("MainActivity: ","iccId :"+ subscriptionInfo.getIccId()+" , name : "+ subscriptionInfo.getDisplayName());
Toast.makeText(context,"iccId :"+ subscriptionInfo.getIccId()+" , name : "+ subscriptionInfo.getDisplayName(), Toast.LENGTH_LONG).show();
}
SubscriptionManager subMgr = SubscriptionManager.from(context);
SubscriptionInfo sir = subMgr.getActiveSubscriptionInfoForSimSlotIndex(1);
if (sir == null) {
}
SubscriptionInfo sirs = subMgr.getActiveSubscriptionInfoForSimSlotIndex(2);
if (sirs == null) {
// not sim 1
} else {
// sim 2
}