Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
SetNetworkConnection(Connection,Enable)
Supported_osSupportAndroidtrue
SEO Metadata
titleSeeTest Client - setNetworkConnection

The command gives the ability to set the network connection for a device.

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

Note: Bluetooth is only supported for Android 5.* and above.

Parameters

  • airplane_mode
  • wifi
  • mobile_data
  • bluetooth

Usage

Code Block
languagejava
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

Code Block
languagejava
titleJava Example
linenumberstrue
client.setNetworkConnection("airplane_mode", true);
Code Block
languagec#
titleC# Example
linenumberstrue
collapsetrue
client.SetNetworkConnection("airplane_mode", true);
Code Block
languagevb
titleVBScript Example
linenumberstrue
collapsetrue
client.SetNetworkConnection("airplane_mode", true)
Report
Code Block
languagepy
titlePython Example
linenumberstrue
collapsetrue
 self.client.setNetworkConnection("airplane_mode", True)
Code Block
languageperl
titlePerl Example
linenumberstrue
collapsetrue
$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:

  1. Turn off MIUI optimization under Developer options.
  2. Reboot the device.
  3. Under Settings go to Permissions.
  4. Click on the gear icon.
  5. Turn off the Permission Manager.