Described here feature is already bundled in AutoTools actions.
This is how it works:
In this project you find one task Set Screen Orientation to easily rotate your phone screen.
The idea is to change accelerometer_rotation and user_rotation constants in Android System Settings (more info here, here and here).
The task Set Screen Orientation supposed to be called from another task with the Perform Task action in Tasker, by setting Parameter 1 (%par1).
- Parameter 1 is setting Screen Orientation. Allowed values are:
- 0 - Default (Auto) . Normal automatic mode.
- 1 - Portrait. Keeps the screen in portrait.
- 2 - Portrait Reverse. Keeps the screen in reverse portrait.
- 3 - Landscape. Keeps the screen in landscape.
- 4 - Landscape Reverse. Keeps the screen in reverse landscape.
- Parameter 1 is validated in the task. If it's not set or is invalid - the task is stopped and the info about the proper settings of the parameter is toasted. So you don't need to remember above parameter values - it will be communicated to you.
Below is an example how to create profile to launch Chrome in landscape and apply correctly settinigs of Parameter 1.
STEP - CREATE PROFILE TO LAUNCH APP IN LANDSCAPE
Above task rotate the phone screen with the most of the applications. It will not work with the apps which have defined activities limiting use of accelerometer or imposing screen orientation.