Created
March 11, 2016 14:28
-
-
Save xgouchet/e46b634732eeb28ad1da 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
Inspired by this stackoverflow question http://stackoverflow.com/questions/10506591/turning-airplane-mode-on-via-adb