In a dual sim mobile phone, how to get which Preferred SIM for Cellular data.
Can someone help me with that?
In a dual sim mobile phone, how to get which Preferred SIM for Cellular data.
Can someone help me with that?
I managed to find a solution which works partially. You can use the TelephonyManager
to obtain the preferred SIM.
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String activeSIMNetwork = tm.getNetworkOperator();
The catch, sometime, the result is not valid on device reboot.
Meaning, if you change from one SIM to another and check, it will give you the correct preferred SIM set in the phone. But if you reboot the phone and check, it will not give you the correctly displayed preference.
I will post an update if I find another way.
Reference: Sim Management setting Programmatically in android