Created
March 21, 2015 16:45
-
-
Save manadream/9a001a4aa28895f121f2 to your computer and use it in GitHub Desktop.
Commands for setting android device orientation from shell
This file contains 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
# first turn off accelerometer controlling the orientation | |
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 | |
# then set orientation | |
shopt -s nocasematch | |
if [ "$ORIENTATION" == "portrait" ] | |
then | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 | |
elif [ "$ORIENTATION" == "landscape" ] | |
then | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to avoid turning off the auto-rotation?
Maybe, alternatively, get the current state of it, and restore it later?