How to switch data from one SIM to another?

chaoscreater

Active member
Hi all,

I'm using a Xiaomi Redmi Note 9T running Android 11, non-rooted.



Is it possible to use adb shell to switch data sim? I know you can use this to turn on/off data:

adb svc data enable/disable

If I manually change the data from SIM1 to SIM2, then I use this:

adb shell settings get global multi_sim_data_call

And the results I get is either:

multi_sim_data_call = 3

multi_sim_data_call = 5

However, if I manually set the value, it doesn't change anything. I've tried to use a broadcast intent like this:

adb shell am broadcast -a android.telephony.action.CARRIER_CONFIG_CHANGED

but it's denied, apparently requires root permission.

I also tried to use "pkill phone" to restart the phone process, but then I get this:

pkill: TERM->2000: Operation not permitted


I've also tried switch_dual_card_slots, but that setting doesn't exist and doesn't do anything on my phone.


I then tried to look up methods such as using this:

service call phone SERVICE i32 y i32 z

but I can't figure out what the SERVICE # is for changing SIM cards......
 

chaoscreater

Active member
I've got a workaround for this atm.

First of all, to turn OFF sim card, you have to use adb shell service call phone. In order to run adb shell, you have to either connect your phone to your PC and run "adb tcpip 5555" and repeat this on every phone reboot, or you can use the LADB app on your phone and run "adb tcpip 5555" from within LADB. This is a bit more involved, but doesn't require any other device to get ADB over wifi (adb tcpip 5555) working. You also have to know what your code is for adb shell service call phone to work. Google it, there are guides about this. Also check out this other post I created for slightly more details:


To turn OFF sim card 2, I just do this:
adb shell service call phone 193 i32 1 i32 0

To turn ON sim card 2, I just do this:
adb shell service call phone 193 i32 1 i32 1

To turn ON sim card 1, I just do this:
adb shell service call phone 193 i32 0 i32 1

To turn OFF sim card 1, I just do this:
adb shell service call phone 193 i32 0 i32 1


When I turn OFF a sim card that is also my data SIM, my phone automatically updates the data SIM to the other SIM. For example, let's say SIM1 is used as my data SIM card. If I turn off SIM1, then SIM2 automatically becomes my data SIM card. Knowing this, we can just play around with the order of turning on & off the SIM cards. For example, let's say I want to move the data from SIM1 to SIM2:

- Turn off SIM1 (data gets moved to SIM2)
- Turn on SIM1 (so that you can still use it for calls/text. Data is still on SIM2).

In my case, I use SIM2 purely for work and don't want to receive any work related text or calls outside of business hours, specifically on weekends. Since my work SIM card comes with free 5G data, I use it instead of paying data for my primary SIM. I only use my primary SIM to make calls or text people, which is a rare occassion these days.

I set MacroDroid to turn off SIM2 on Saturday 12am and then enable it on Monday. However, data SIM has moved from SIM2 to SIM1. So basically I just need to do this:

- Turn on SIM2
- Turn off SIM1 (data moves to SIM2)
- Turn on SIM1

It's not elegant, but it works.
 
Top