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
only worked on Rooted device..
turn onAirplane mode :
adb shell -c settings put global airplane_mode_on 1
adb shell -c am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
turn off Airplane mode :
adb shell -c settings put global airplane_mode_on 0
adb shell -c am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
For newer android this en/disables wifi. Not quite your task, but i would've been happy to find it here:
adb shell svc wifi disable
or
adb shell svc wifi enable
Credit goes to this answer: https://stackoverflow.com/a/27228962/1021872
In my .zshrc file I added this to simulate airplane mode.
alias android:online="androidOfflineOnline enable"
alias android:offline="androidOfflineOnline disable"
function androidOfflineOnline {
   adb shell svc data $1
   adb shell svc wifi $1
}
If the phone is rooted then you can use this command. Also if using Magisk, shell must be given "su" permission
adb -s ZY32234G3V shell "su -c 'input keyevent KEYCODE_WAKEUP;input keyevent KEYCODE_MOVE_HOME;settings put global airplane_mode_on 1;am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true'"
adb -s ZY32234G3V shell "su -c 'input keyevent KEYCODE_WAKEUP;input keyevent KEYCODE_MOVE_HOME;settings put global airplane_mode_on 0;am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false'"
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
adb shell input keyevent 19 & adb shell input keyevent 23
Use the following command to launch Settings > Wireless networks, toggle Airplane mode and return (by pressing Back):
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS & adb shell input keyevent 19 & adb shell input keyevent 23 & adb shell input keyevent 4adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS ; adb shell input keyevent 19 ; adb shell input keyevent 23 ; adb shell input keyevent 4Tested on Samsung Galaxy S (Android OS 2.3.3).