Turn on/off second SIM card?

chaoscreater

Active member
My phone (Xiaomi, non-rooted) supports dual SIM and I want to turn off and turn on my 2nd SIM card at specific times. Reason being is that my 2nd SIM card is for work and I don't want to be receiving text or calls outside of business hours.

I've looked this up online and tried using a custom setting as per guide here:
https://www.reddit.com/r/tasker/comments/b0a1o5
However, it doesn't work. I've also tried using adb shell directly as per below:

adb shell settings put secure phone0_on 0
adb shell settings put secure phone1_on 0
adb shell settings put secure phone2_on 0

adb shell settings put system phone0_on 0
adb shell settings put system phone1_on 0
adb shell settings put system phone2_on 0

I didn't get any errors running the commands, but no changes were made. Any ideas what else I can try? I don't want to use UI Interaction because it's not an elegant approach
 

420

Active member
My phone (Xiaomi, non-rooted) supports dual SIM and I want to turn off and turn on my 2nd SIM card at specific times. Reason being is that my 2nd SIM card is for work and I don't want to be receiving text or calls outside of business hours.

I've looked this up online and tried using a custom setting as per guide here:
https://www.reddit.com/r/tasker/comments/b0a1o5
However, it doesn't work. I've also tried using adb shell directly as per below:

adb shell settings put secure phone0_on 0
adb shell settings put secure phone1_on 0
adb shell settings put secure phone2_on 0

adb shell settings put system phone0_on 0
adb shell settings put system phone1_on 0
adb shell settings put system phone2_on 0

I didn't get any errors running the commands, but no changes were made. Any ideas what else I can try? I don't want to use UI Interaction because it's not an elegant approach
Can you not set a schedule somehow somewhere so that it will only be able to receive text/calls during business hours? Or could you possibly set do not disturb for only one of your sim cards? (i really don't know, just thinking out loud)
 

Snurre

Well-known member
I don't know Xiaomi, I've got a Huawei and a Samsung, but you can try to look under 'System settings' in MD
Don't look for phone but for sim, there might be something like 'sim1_value' or 'default_sim'
I don't know if this can guide you in the right direction, but I think it's worth to give it a try
 

chaoscreater

Active member
Can you not set a schedule somehow somewhere so that it will only be able to receive text/calls during business hours? Or could you possibly set do not disturb for only one of your sim cards? (i really don't know, just thinking out loud)
Cannot set do not disturb for just one SIM unfortunately. Not sure what you mean by a schedule for receive text/call, I don't see this anywhere in the Android setting or in MacroDroid. I actually want to disable the entire SIM because the provider doesn't have a lot of coverage in my area, which means the signal reception is always poor and therefore drains my battery unnecessarily. I want to disable the SIM entirely.

I don't know Xiaomi, I've got a Huawei and a Samsung, but you can try to look under 'System settings' in MD
Don't look for phone but for sim, there might be something like 'sim1_value' or 'default_sim'
I don't know if this can guide you in the right direction, but I think it's worth to give it a try
Tried that by using the following:

adb shell settings list system
adb shell settings list secure
adb shell settings list global

The only variables I found with the "SIM" keyword are these:

msim_mode_setting=3
multi_cb=0
multi_sim_data_call=3
multi_sim_sms=3
multi_sim_voice_call=-1

I tried to adjust the settings and they didn't make a difference. I also looked them up on Google but found nothing.
 

chaoscreater

Active member
Saw that already. I'm pretty sure that requires root.

UPDATE:
Came across this post on StackOverflow and I managed to get it working using adb shell:
https://stackoverflow.com/questions...er-using-activities-intents/48739201#48739201

I found the "x" number by following the instructions. In my case, it's 193. So the command is:
adb shell service call phone 193 i32 1 i32 0

Now I just gotta convert it to shell script and hope that it works without using root....


1634631319873.png



Update 2:

Nope, doesn't work with shell script.......works with adb shell on PC but can't seem to run it without root on phone.

Update 3:
OK, I downloaded this:

And I ran adb tcpip 5555 on my PC, then I ran "service call phone 193 i32 1 i32 0" (without the quotes) in ADBPlugin. It works fine.

If you want to run adb tcpip 5555 directly on your phone, then you'd need to use wireless debugging (Android 11), set up wireless ADB pairing, then use the LADB app from Google Play and then run adb tcpip 5555.

I just need to figure out how to get this working by just using MacroDroid and nothing else. Atm, I can use the ADBPlugin in MacroDroid and enter the commands in there and have it run completely automated. But I don't really think there's a need for another plugin or app.....I'm so close to the final solution. Anyone have any ideas?
 
Last edited:

japitoekabapi

New member
Saw that already. I'm pretty sure that requires root.

UPDATE:
Came across this post on StackOverflow and I managed to get it working using adb shell:
https://stackoverflow.com/questions...er-using-activities-intents/48739201#48739201

I found the "x" number by following the instructions. In my case, it's 193. So the command is:
adb shell service call phone 193 i32 1 i32 0

Now I just gotta convert it to shell script and hope that it works without using root....


View attachment 1290



Update 2:

Nope, doesn't work with shell script.......works with adb shell on PC but can't seem to run it without root on phone.

Update 3:
OK, I downloaded this:

And I ran adb tcpip 5555 on my PC, then I ran "service call phone 193 i32 1 i32 0" (without the quotes) in ADBPlugin. It works fine.

If you want to run adb tcpip 5555 directly on your phone, then you'd need to use wireless debugging (Android 11), set up wireless ADB pairing, then use the LADB app from Google Play and then run adb tcpip 5555.

I just need to figure out how to get this working by just using MacroDroid and nothing else. Atm, I can use the ADBPlugin in MacroDroid and enter the commands in there and have it run completely automated. But I don't really think there's a need for another plugin or app.....I'm so close to the final solution. Anyone have any ideas?
Yo i did it (with root) using just shell commands for some reason you need to specify you're a shell user so it's su shell -c service call phone x i32 y i32 z
 
Is it possible not to have to put in the sim code when re enabling the 2nd sim card ? By, I don't know, having an "airplane mode" but just for SIM 2 ?
 

chaoscreater

Active member
OK... So no way to deactivate a SIM card without having to enter the PIN when re enabling it ?
Not sure what you mean. I never had to enter any PIN to enable a SIM card. It's literally a on/off toggle, just like toggling mobile data, except for toggling sim card on/off for sim1 or sim2.
 
Yes, at each boot I have to enter my simcards PIN. I never thought of disabling this protection, it's true it's not very useful anymore since smartphones have several ways of screen (un)locking...
 

Qarboz

Well-known member
Yes, at each boot I have to enter my simcards PIN. I never thought of disabling this protection, it's true it's not very useful anymore since smartphones have several ways of screen (un)locking...
Beware that in case of theft probably the thief will not be able to use the smartphone, but he can insert the SIM card in another phone and use it at your expense.
 

Endercraft

Moderator (& bug finder :D)
Beware that in case of theft probably the thief will not be able to use the smartphone, but he can insert the SIM card in another phone and use it at your expense.
Yes, in case of theft they will be able to use the SIM. What I did when my phone got stolen was call my operator, tell them to disable my SIM card rendering it useless and order a new one.
 

Qarboz

Well-known member
Yes, in case of theft they will be able to use the SIM. What I did when my phone got stolen was call my operator, tell them to disable my SIM card rendering it useless and order a new one.
This is the correct procedure. However, it can become difficult if you are abroad (I often go there for work)
 
Top