I want to share how to toggle SIM card using command line.
Execute below command using root
service call phone 158 i32 <SIM_SLOT> i32 <SIM_STATE>
Where <SIM_SLOT> is
0 = SIM 1
1 = SIM 2
Where <SIM_STATE> is
1 = SIM on
0 = SIM off
For example:
- Turn off SIM 2 command: service call phone 158 i32 1 i32 0
- Turn on SIM 2 command: service call phone 158 i32 1 i32 1
Now, I can turn SIM on or off using Tasker
Credit: kylemd from [GUIDE] [ROOT] Switch off individual SIMs with Tasker.
Thanks for the guide
Edit- Figured it out from the credited link:
service call phone 158 i32 0/1 i32 0/1
Where the red 0/1 represents:
0 = SIM 1
1 = SIM 2
And the blue 0/1 represents:
0 = OFF
1 = ON
I tried this out. While I was able to turn off the SIM, it didn't turn back on until after a reboot. Any idea why?
oreo27 said:
Edit- Figured it out from the credited link:
service call phone 158 i32 0/1 i32 0/1
Where the red 0/1 represents:
0 = SIM 1
1 = SIM 2
And the blue 0/1 represents:
0 = OFF
1 = ON
I tried this out. While I was able to turn off the SIM, it didn't turn back on until after a reboot. Any idea why?
Click to expand...
Click to collapse
Sorry, I've correct command line.
I don't have any issue turn back on any SIM, no need to reboot to turn it on.
Here is a possible commmands
Enable SIM 1: service call phone 158 i32 0 i32 1
Disable SIM 1: service call phone 158 i32 0 i32 0
Enable SIM 2: service call phone 158 i32 1 i32 1
Disable SIM 2: service call phone 158 i32 1 i32 0
mnirun said:
Sorry, I've correct command line.
I don't have any issue turn back on any SIM, no need to reboot to turn it on.
Here is a possible commmands
Enable SIM 1: service call phone 158 i32 0 i32 1
Disable SIM 1: service call phone 158 i32 0 i32 0
Enable SIM 2: service call phone 158 i32 1 i32 1
Disable SIM 2: service call phone 158 i32 1 i32 0
Click to expand...
Click to collapse
No worries! Yes, I was able to change the status without rebooting when using the correct syntax.
it doesn't work in mi mix2 global 8.5.8 anyone knows the correct address?
What about data ? Is there anything like that to switch data connectivity between slots ?
Cheers,
Tony
I think this is only for stock rom?
Tried turning off sim one on with validus os, and both Sims are disabled
Sent from my Mi A1 using Tapatalk
ToRvaLDs said:
it doesn't work in mi mix2 global 8.5.8 anyone knows the correct address?
Click to expand...
Click to collapse
It's 159 (based on 8.4.27_8.0 Global ROM), it should be the same on global 8.5.8
The command work on my X00TD running Oreo 8.1, but its only DATA/Connectivity toggle. Is there a command to switch On/Off SimCard?.
I'm looking for this command because one of my SimCard doesn't have good signal reception, thus the battery drain faster.
Related
Hi,
I'm trying to write some scripts that will turn on/off various functions of my rooted phone running a Cyanogen 6 based ROM (especially those functions that can't be programmatically manipulated through standard apps on non-rooted phones).
One approach I figured (Approach 1), would be to simply write 1/0 in the sqlite settings database for various settings (/data/data/com.android.providers.settings/databases/settings.db). However, simply writing on/off there does not automatically turn on/off those functions. After a reboot this will work though.
Another approach (Approach 2) would be to call various services with various parameters. For example this:
wifi on: service call wifi 13 i32 1
wifi off: service call wifi 13 i32 0
Will turn on/off the Wifi.
My questions are:
Which of these 2 approaches would you recommend?
Do you recommend any other approaches?
For "Approach 1", do you know of another way (besides rebooting the phone) that would force the phone to take the new settings in the database into consideration?
For "Approach 2", where could I find some documentation so that I will know how to manipulate the other services? (I'm interested especially in: GPS, Mobile Networks Location, 2G/3G switch, Data connection, Background data connection, Ringer, Auto sync)
Thanks,
Andrei
adding few more commands
This is not the answer, but I've found few more commands which can be helpful.
#service call connectivity 14 i32 1 -> Mobile Data ON (NEED ROOT)
#service call connectivity 14 i32 0 -> Mobile Data OFF (NEED ROOT)
#service call connectivity 12 i32 1 -> Background service ON
#service call connectivity 12 i32 0 -> Background service OFF
maybe a late reply, almost 2 years sincs op.
i look up information about the service interface directly from the aidl files, these files are well documented.
so for the example you gave, look at IWifiManager.aidl, the methods are numbered in sequence (starting at 1). the 13 entry is for setWifiEnabled(Bool), notice that i32 is encoding an integer into a boolean value.
for more information, the underlying system of IPC in android is managed by Binder.
Hello! I have a question! I have Droid Maxx, Droid Mini? Droid Ultra and I want to use in CDMA networks my operator, but without the use of RUIM card as still use GSM, for this I want to flash settings on my CDMA operator. I change using SQLite Editor line subscription_mode = 0 to 1 in com.android.providers / settings / global
But after rebooting subscription_mode value returns to 0 and then I can not do anything.
Please show me the way how to make that value subscription_mode not reset to 0, and 1 left on.
?
Managed to change?
matros2000 said:
Hello! I have a question! I have Droid Maxx, Droid Mini? Droid Ultra and I want to use in CDMA networks my operator, but without the use of RUIM card as still use GSM, for this I want to flash settings on my CDMA operator. I change using SQLite Editor line subscription_mode = 0 to 1 in com.android.providers / settings / global
But after rebooting subscription_mode value returns to 0 and then I can not do anything.
Please show me the way how to make that value subscription_mode not reset to 0, and 1 left on.
Click to expand...
Click to collapse
I have no idea about the settings you are attempting to modify, but my guess about values not sticking would be - you need write protection off. How to get write protection off, that's another question answer to which depends on a few variables - your current version, assembly date, update history. You need to obtain root, if possible, which would allow you to write to system and modify the setting you need.
Z3 locked with service provider_
I want to unlock my phone but I'm not sure that it will work. because when we look at the service menu of phone.
it write:
[]Network 0
[]Network subset 0
[x]Service provider 0
[]corporate 0
[]Sim 0
in the sim lock menu.
And I already take a NCK code by the operator, but the phone doesn't accept.
could you help me about this.
Ask your operator to send you a correct NCK code.
I am having an issue with the phone displaying No Signal with whatever SIM I insert in any of the two slots. Tried cleaning the slots by blowing air, also did a factory reset but those doesn't seem to work. Sometimes a RED CROSS is appearing in the place of network bars then going off in a fraction of sec. However I managed to get into the engineering mode using *#*#4636#*#* code then hit Phone Info where I found the following information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMEI xxxx....xxxx (Thats ok as far as my IMEI check *#06# and Phone package is concerned)
Phone number: unknown
Current network:
Run ping test (Thats a clickable button)
Ping IpAddr:
Ping Host Name (www . google . co . uk)
HTTP Client test:
Signal strngth: 0 dBm 99asu
Location: LAC = unknown CID = unknown
Neighbouring CID: unknown
CellInfo:
Roaming: Not roaming
GSM Service: Radio off
GPRS Service: Disconnected
Network type: unknown,Unknown
Message waiting: false
Call redirect: false
Call status: idle
Radio resets: 0
Data attempts: 0
Data successes: 0
GSM disconnects: ========DATA========
PPP sent: 0pkts, 0 bytes
PPP received: 0pkts, 0 bytes
Number of PPP reset since boot: 0
Set preferred network type
Unknown (Drop down list. If this is changed, it automatically resets to Unknown)
Turn on radio (Thats a clickable button. If clicked it shows "Turn Off Radio" for a few secs again goes back to "Turn on Radio")
CellInfoListRate 2147483647 (Thats a clickable button)
Turn on IMS registration requirement (Thats a clickable button)
Turn on SMS over IMS (Thats a clickable button)
Turn on lte ram dump (Thats a clickable button)
SMSC: __________ <Update> <Refresh>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Desperately started looking out for solutions over the web but none seemed to hit the nail. At last landed up on this forum that looks a little alive. Please help me to get this fixed as I am all turned down to a out-fashioned and outdated keyed phone that I seriously dislike.
Hope to get my phone back to life soon with help from you guys.
Hi,
I use two SIM cards on my OnePlus 6 (rooted OOS 10.3.0); one for personal use and one for work.
I've been trying to find a suitable shell command that turns off the second SIM-slot (SIM2) which has my work SIM in it.
The idea is to combine the command with automation software like Easer, to turn the second SIM off for specific hours of day.
You currently have to go to the phone settings and disable the second SIM manually.
After searching the internet I found this thread on stackoverflow: LINK
The suggested solution says to use what is called service call function:
Code:
service call phone x i32 y i32 z
Where:
x = index number you fetched previously,
y = your subscription ID (generally, SIM1 = 0, SIM2 = 1)
z = whether on (1) or off (0)
I tried digging up the correct x value as suggested on stackoverflow and came up with the following command:
Code:
service call phone 178 i32 1 i32 0
However, after running this command as root on Termux terminal, it outputs a lot of text and nothing seems to happen to SIM2. It doesn't turn off.
I've attached the output of running the command.
I wouldn't want to just randomly call some functions by changing the x to a different number. Who knows what you might do to your phone, as you're running the command as root after all.
What gives? Am I just using the wrong function call? If so, then what is the correct one?
Any tips or leads on what to do?