SubscriptionInfo.getMnc() returns the same value for both the SIMs with different carriers
Asked Answered
D

2

15

I was trying to get the MCC and MNC number (basically I want the IMSI number but these will also suffice) in Android 5.1 device having dual Sim (both active). As 5.1 supports dual Sim so I used the Subscription manager like this:

SubscriptionManager manager = SubscriptionManager.from(this);
List<SubscriptionInfo> sil = manager.getActiveSubscriptionInfoList();
    if (sil != null) {
        for (SubscriptionInfo subInfo : sil) {
            Log.v("TestMain", "SubInfo:" + subInfo);
        }
    } else {
        Log.v("TestMain", "SubInfo: list is null");
    }

and got the this output:

07-24 18:28:32.162    3844-3844/? V/TestMain﹕ SubInfo:{id=1, mcc 405 mnc 803, iccId=89918030914128062059 simSlotIndex=0 displayName=Aircel Karnataka carrierName=Aircel — Aircel Karnataka nameSource=0}
07-24 18:28:32.162    3844-3844/? V/TestMain﹕ SubInfo:{id=2,  mcc 405 mnc 803, iccId=8991860044481968955 simSlotIndex=1 displayName=CARD 2 carrierName=Vodafone Karnataka nameSource=0}

MCC(will be same as it the same country) notice that MNC are same though the carriers are different.

While I was switching off the phone I saw this lines in my logcat:

07-24 18:31:02.295      616-616/? V/KeyguardUpdateMonitor﹕ SubInfo:{id=1,  mcc 405 mnc 803, iccId=89918030914128062059 simSlotIndex=0 displayName=CARD 1 carrierName=Emergency calls only — Aircel Karnataka nameSource=0}
07-24 18:31:02.295      616-616/? V/KeyguardUpdateMonitor﹕ SubInfo:{id=2,  mcc 404 mnc 86, iccId=8991860044481968955 simSlotIndex=1 displayName=CARD 2 carrierName=Emergency calls only — Vodafone Karnataka nameSource=0}

As you can see the keyguard application gets the MNC right for both the sim.

So I explored the code of the keyguard application and found that the code is same as I was using Code from Android Source taken from here:

protected void handleSimSubscriptionInfoChanged() {
        if (DEBUG_SIM_STATES) {
            Log.v(TAG, "onSubscriptionInfoChanged()");
            List<SubscriptionInfo> sil = mSubscriptionManager.getActiveSubscriptionInfoList();
            if (sil != null) {
                for (SubscriptionInfo subInfo : sil) {
                    Log.v(TAG, "SubInfo:" + subInfo);
                }
            } else {
                Log.v(TAG, "onSubscriptionInfoChanged: list is null");
            }
        }

I explored some more and found that even the keyguard applications gets MCC right only when the phone is switching off, other times even it is getting the same MNC for both the SIMs. But the carrier name is distinct always.

Is this a bug in Android 5.1 or am I doing something wrong?

Dinky answered 24/7, 2015 at 13:32 Comment(3)
I suppose this was a bug in android, it got fixed after I updated the phone.Dinky
The same exact issue on Motorola Moto E running Android 5.1Zemstvo
I have the same problem on Android 6.Chil
D
0

This was a bug in android 5.1, it got fixed after I updated the phone

Dinky answered 10/6, 2019 at 14:20 Comment(0)
F
0

I got the same issue in Android 5.1 in Samsung J5, but its working in Android 6.0 in Moto X Play. Since SubscriptionManager was introduced in Android 5.1, I guess this is a bug in Android 5.1, which was corrected in Android M.

Florentinaflorentine answered 23/5, 2016 at 6:2 Comment(0)
D
0

This was a bug in android 5.1, it got fixed after I updated the phone

Dinky answered 10/6, 2019 at 14:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.