How can I rotate the device in appium with Java?

How can I rotate the device in appium with Java?

Hi Macy,

Please check the following commands for Java:

We have tried this script and its working, below is the sample java command we can use -

1driver.activateApp("bundleId"); //pass your app's package name here
2HashMap paramsRotate = new HashMap();
3paramsRotate.put("command", "autorotate");
4paramsRotate.put("enableAutoRotate", false);
5driver.executeScript("lambda-adb", paramsRotate);