-
-
Save beebird/41298f449e7d781bf442f86c8b37174c to your computer and use it in GitHub Desktop.
Shell script to toggle airplane mode on connected device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adb_toggle_airplane_mode { | |
# Open airplane mode settings | |
adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS | |
# Key UP to focus on the first switch = toggle airplane mode, then sleep 100ms | |
adb shell input keyevent 19 ; sleep 0.1 | |
# Key CENTER to toggle the first switch, then sleep 100ms | |
adb shell input keyevent 23 ; sleep 0.1 | |
# Key BACK to close the settings | |
adb shell input keyevent 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment