How set airplane mode in Android 7+ (emulators and real devices)

I am trying figure out how I can set the airplane mode when I am testing in emulators and real devices with Android 7+. The method driver.setConnection(Connection.AIRPLANE) works only in Android 6 or older (emulators and real devices). I tried use the command adb shell am broadcast -a io.appium.settings.wifi --es setstatus disable from Android, but it works only for real devices with Android 7 or newer, it doesn’t work for emulators and Android 6 or older. So, how can I fix this problem? There are some way to set the airplane mode in all Android versions (real devices and emulators)?

Thanks.

1 Like