0

I am building an android application where I need to get Mcc and Mnc value of SIM. For single SIM I got perfect code but how to use that for dual SIM. I am using below code working fine above lollipop devices to get these two value.

  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1)
    {
        SubscriptionManager manager = SubscriptionManager.from(this);
        List<SubscriptionInfo> sil = null;
        sil = manager.getActiveSubscriptionInfoList();
        if (sil != null) {
            for (SubscriptionInfo subInfo : sil) {
                Log.v("TestMain", "SubInfo:" + subInfo);
                Log.v("SIM_SLOT_INDEX"+ subInfo.getSimSlotIndex() +" mcc", subInfo.getMcc()+"");
                Log.v("SIM_SLOT_INDEX"+ subInfo.getSimSlotIndex() + " mnc", subInfo.getMnc()+"");}}

Can some one help me to finding below lollipop version how to can I get Mnc and Mcc value of Both SIM.

Hitesh Matnani
  • 309
  • 1
  • 5
  • 20
  • 1
    There was no native support for multiple SIMs in Android before API 22. Solutions will vary depending on the manufacturer/vendor. – Mike M. Dec 01 '16 at 03:42
  • @MikeM. can you provide me a common solution as I seen other application doing same. – Hitesh Matnani Dec 01 '16 at 06:14
  • There's not going to be a solution common to every pre-API 22 device. That was the point of my comment. The [answer linked](http://stackoverflow.com/a/32871156) in the duplicate above may provide you with decent coverage, but, as mentioned, it's not going to be universal. You'll have to decide which devices/OEMs you want to support, possibly investigate and implement their proprietary APIs, and test as needed. – Mike M. Dec 01 '16 at 06:20
  • @MikeM. I am getting error "java.lang.NoSuchMethodException: getDefault [int]" – Hitesh Matnani Dec 05 '16 at 10:40

0 Answers0