Android emulator device pose / rotate

Is it possible to change the device pose programatically under Virtual sensors shown in the image?

I am able to change some sensors using using the following command for e.g.

string command_gyro = "sensor set gyroscope " + 0 + ":" + 0 + ":" + i;
                _driver.ExecuteScript("mobile: execEmuConsoleCommand", new Dictionary<string, string>
                {
                    { "command", command_gyro },
                });


https://stackoverflow.com/questions/70101598/android-emulator-device-pose

You could also try if https://github.com/appium/appium-uiautomator2-driver#mobile-sensorset works for your case.

Thanks!

I could not find a way to change the rotation or move using either of those commands. Any idea how to specifically change those?

(Screenshot for move)

I tried the following which does not work unlike the execEmuConsoleCommand command -
_driver.ExecuteScript(“mobile: sensorSet”, new Dictionary<string, string>
{
//{ “sensorType”, “move” },
{ “sensorType”, “gyroscope” },
{ “value”, “0:0:0” }
});

you are right. The sensorSet mobile command was added a while ago and should be updated to support the most recent emulator features. For now execEmuConsoleCommand would be the only way to achieve what you need

For time being camera/device pose reset can be achieved by rotating multiple times which resets the rotation x,y,z.

_driver.ExecuteScript("mobile: execEmuConsoleCommand", new Dictionary<string, string> { { "command", "rotate" } });

I would also try the rotation api for such purpose: https://github.com/appium/java-client/blob/0e05078d0ae8e4bebb80080790712e933e2ea666/src/test/java/io/appium/java_client/ios/RotationTest.java