Change the orientation of Android devices from the command line

I am launching a series of automatic tests on Android devices that are hosted on html pages on a local server. Some of the tests should be performed in Portrait, some in the landscape. I am trying to find a way to check and change the orientation of a device or browser programmatically.

I am currently writing in Python / Jython / Monkeyrunner / ADB, but I can switch if there is a good solution for this from another source.

basic test will be launched:

check orientation / change orientation open URL activate test on page get results repeat

I tried the "18 i32 1 service call window", which would be ideal for my purposes, but I get errors, i.e. "Result: package (fffffffc ffffffff" ........ ")"

Is there a way to trigger this as a browser / android action? Is there a way to trick tilt events to trigger a change? Can this be done from an application installed and running as a package?

Sorry, it seems I was unclear. I will not use the emulator, but rather a series of real Android devices connected via USB. Any help on this topic would be appreciated, including the assurance that there is no predefined method for this. Thanks,

+6
source share
1 answer

You can change the orientation of the emulator when the emulator is focused, if you press Ctrl + F11 or KEYPAD_7. Additional emulator options are here http://developer.android.com/guide/developing/tools/emulator.html

-1
source

Source: https://habr.com/ru/post/885779/


All Articles