You may have an app at some point that requires a set screen orientation. Using PhoneGap in Android this is done by editing your project’s manifest.xml. This file is located in your project root. Double click the file to open it within Eclipse and note the activity node:
... <activity android:configChanges="orientation|keyboardHidden" android:name=".MyPhoneGapActivity" android:label="@string/app_name" > ...
You will add the following to it:
android:screenOrientation=”portrait”
or
android:screenOrientation=”landscape”
Which would look like this:
... <activity android:configChanges="orientation|keyboardHidden" android:name=".MyPhoneGapActivity" android:label="@string/app_name" android:screenOrientation="portrait" > ...
In PhoneGap 2.8.1 they have added a “preference” to config.xml for screen orientation, but oddly it doesn’t seem to work on the Android 4.1.1 test device I have (a Samsung Galaxy Tab 2).
The tag looks like this:
... <preference name="orientation" value="portrait" /> ...
Simply add it above the feature tags in config.xml… but as I mentioned, it doesn’t work. Maybe this is forward looking or maybe its broken in PhoneGap 2.8.1, either way the first method continues to work.