SeeTest Client - setNetworkConnection
info
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
SetNetworkConnection(Connection,Enable)
Description
The command gives the ability to set the network connection for a device.
Execute any of the following connection types:
airplane_mode, wifi, mobile_data, bluetooth
info
Notes:
- Bluetooth is only supported for Android 5.* and above.
- Changing wifi status for Android 10+ devices is only supported for cloud devices. In STA the feature will work for older devices only.
- For Android 10+ devices: changing wifi status requires work profile set on the devices. The following steps should be taken on the first time using work profile:
- Verify that there is no owner account set in the devices settings (Google account, Samsung account, etc.). The account can be set again after work profile set up is done.
- Set the property android-enable-work-profile to true in the server conf xml file.
- Reconnect/reboot relevant devices.
- Set the device account again if needed.
Parameters
- airplane_mode
- wifi
- **mobile_data
** - bluetooth
Usage
client.setDevice("adb:GT-I9505");
client.setNetworkConnection("airplane_mode", true);
client.setNetworkConnection("mobile_data", true);
client.setNetworkConnection("wifi", true);
client.setNetworkConnection("bluetooth", true);
Code Examples
Java Example
client.setNetworkConnection("airplane_mode", true);
C# Example Expand source
client.SetNetworkConnection("airplane_mode", true);
VBScript Example Expand source
client.SetNetworkConnection("airplane_mode", true)
Report
Python Example Expand source
self.client.setNetworkConnection("airplane_mode", True)
Perl Example Expand source
$client->setNetworkConnection("airplane_mode", 1);
Note: Some Xiaomi devices with Android 6 and MIUI 9 Xiaomi have added their own permission manager. It needs to be disabled to use this command.
In order to do disable Permission Manager:
- Turn off MIUI optimization under Developer options.
- Reboot the device.
- Under Settings go to Permissions.
- Click on the gear icon.
- Turn off the Permission Manager.