Package 

Class NetworkImpl

  • All Implemented Interfaces:
    com.kaspersky.kaspresso.device.network.Network

    
    public final class NetworkImpl
     implements Network
                        

    The implementation of the Network interface.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public class Companion
    • Method Summary

      Modifier and Type Method Description
      Unit enable() Enables both Wi-Fi and mobile data.
      Unit disable() Disables both Wi-Fi and mobile data.
      Unit toggleMobileData(Boolean enable) Toggles only mobile data.
      Unit toggleWiFi(Boolean enable) Toggles only Wi-Fi.
      • Methods inherited from class com.kaspersky.kaspresso.device.network.Network

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • enable

         Unit enable()

        Enables both Wi-Fi and mobile data.

        Required Permissions: INTERNET.

      • disable

         Unit disable()

        Disables both Wi-Fi and mobile data.

        Required Permissions: INTERNET.

      • toggleMobileData

         Unit toggleMobileData(Boolean enable)

        Toggles only mobile data. Tries to change state with adb command first and using Settings then.

      • toggleWiFi

         Unit toggleWiFi(Boolean enable)

        Toggles only Wi-Fi. Tries, first and foremost, to change Wi-Fi state using Android API if targetApi is lower than 29 and Manifest.permission.CHANGE_WIFI_STATE permission is granted. In case of failure, sends ADB command. If this attempt fails too, opens Android Settings screen and tries to switch Wi-Fi setting thumb.