I would like to lock the screen orientation specifying the configuration in the AndroidManifest, instead of doing it programmatically. So I've ended up with the following approach:
values/config.xml
<resources>
<integer name="orientation">1</integer>
</resources>
values-sw600dp/config.xml
<resources>
<integer name="orientation">0</integer>
</resources>
If I check the value’s resource programmatically
getResources().getInteger(R.integer.orientation)
I get the expected value: 0 for tablets and 1 for handsets, which is the value specified by the framework for landscape and portrait orientation respectively.
But if I use this resource in the AndroidManifest:
<activity
android:name="activities.InitialConfigActivity_"
android:noHistory="true"
android:screenOrientation="@integer/orientation" />
The activity always launches in portrait mode, regardless if it is a tablet or a handset device.
Any thoughts?
Thanks!