Activity in portrait or reverse portrait only

Speedy picture Speedy · Oct 7, 2011 · Viewed 19.8k times · Source

I want my activity to be available only in both portrait modes - portrait and reversePortrait. How can I achieve this? When I set android:screenOrientation="portrait" it will force activity to be only in normal portrait - vice versa with reversePortrait.

Please, don't tell me it's a bad approach to force/lock orientation. I know about it, but still client is requesting it. Thanks for understanding and for any ideas.

UPDATE: API Level 11 and higher

Answer

user658042 picture user658042 · Oct 7, 2011

If you are on API level 9+, use android:screenOrientation="sensorPortrait".

Portrait orientation, but can be either normal or reverse portrait based on the device sensor. Added in API level 9.

Documentation