Toggle Radio (FR)
Perfecto Command
mobile:radio:toggle
Purpose
Turns the device's radio signal on or off. This essentially disconnects or re-connects the cellular service of the device.
Limitations and considerations
The command works for devices running Android 9.0 or earlier, but this is subject to Google not changing the implementation, so the command is not guaranteed to work in the future.
If the device does not reconnect when the Radio signal is turned on, you may need to do one of the following:
- Reboot the device.
- Turn Airplane Mode off (using Set Network Settings command) and immediately back on.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
mode | String | on | off | State to set the radio signal. On- connects to the cellular network Off- disconnects from the cellular network |
Return Value
OK
Exceptions
None
Examples
Copy
Java sample
Map<String, Object> pars = new HashMap<>();
pars.put("mode", "off");
String reStr = (String) driver.executeScript("mobile:radio:toggle", pars);
Copy
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("mode", "on");
String reStr = (String) driver.ExecuteScript("mobile:radio:toggle", pars);