Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

automation - Changing Android Device orientation with ADB

I'm using Android 4.4 on a real device and I want to set the device orientation via adb. I don't want it done with uiautomator since it won't last after the termination of the uiautomator code.

How can I do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You may first need to turn off the automatic rotation:

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0

Rotate to landscape:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1

Rotate portrait:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...