开发者

Changing Android device orientation from command line

开发者 https://www.devze.com 2023-02-24 00:24 出处:网络
I am running a series of automated tests on Android devices which are hosted in html pages on a local server. Some of the tests need to be run in Portrait, some in landscape. I am trying to find the w

I am running a series of automated tests on Android devices which are hosted in html pages on a local server. Some of the tests need to be run in Portrait, some in landscape. I am trying to find the way to check and change the orientation of the device or the browser programmatically.

Currently I am writing in Python/Jython/Monkeyrunner/ADB but I could switch if there were a good solution to this from some other source.

a basic test would be run:

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

I have tried "service call window 18 i32 1", which would be ideal for my purposes, but I only get errors, ie "Result: Parcel(fffffffc ffffffff '........')"

Is there a way to call this as an activity of the browser/android? Is there a way to spoof tilt events to trigger the change? Could this be done from within an app, installed and run as a package?

Sorry, it seems I wasn't clear. I will not be using an emulator but rather a series of actual a开发者_Python百科ndroid devices, hooked in through the USB. Any help on this topic would be appreciated, including knowing for sure that there is no pre-defined method for this to happen. Thanks,


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号