I\'ve looked all over and I haven\'t found a concrete answer to this question. I\'m hoping to find a way to toggle airplane mode from ADB that doesn\'t involve the GUI in an
If you have root access, and the method in the answer from David Ferenczy Rogožan left you with a security exception:
Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE
you can try to run the commands as superuser as follows.
adb shell "su -c 'settings put global airplane_mode_on 1'"
adb shell "su -c 'am broadcast -a android.intent.action.AIRPLANE_MODE'"
adb shell "su -c 'settings put global airplane_mode_on 0'"
adb shell "su -c 'am broadcast -a android.intent.action.AIRPLANE_MODE'"
In my experience with Android 9 the explicit invoke of su was only necessary for the broadcasting command while for the former I could keep:
adb shell settings put global airplane_mode_on [0|1]
Credits to Arya who left this trick into the comment section of the answer mentioned above.