Road to capture screenshot using Appium java

Use below function to capture screen shot of android application using Appium.

// capturing screenshot
    public void captureScreenshot(String fileName) {
        try {       
            FileOutputStream out = new FileOutputStream( fileName + ".jpg");
            out.write(((TakesScreenshot) driver)
        } catch (Exception e) {      }

Road to automate Network feature of device using Appium

Appium provide NetworkConnectionSetting class using this we can disable and enable network setting of mobile.
Below example show you how to enable and disable network of mobile using Appium.

public void testNetwork()

                    NetworkConnectionSetting networkConnection  = (AndroidDriver driver).getNetworkConnection();




                  ((AndroidDriver )driver).setNetworkConnection(networkConnection);

                  networkConnection = ((AndroidDriver )driver).getNetworkConnection();

                 System.out.println("Aireplane Mode status "+networkConnection.airplaneModeEnabled());

                   System.out.println("Data Mode status "+networkConnection.dataEnabled());

                   System.out.println("Wifi Mode status "+networkConnection.wifiEnabled());