How To Fix Screen Orientation To Portrait For My Whole Phonegap App
How to configure the Phonegap app to be fixed to only portrait mode, I there any possibility to do it with CSS or JavaScript so that I should be able to get the consistent behaviou
Solution 1:
To fix your orientation in portrait mode just add the below line in your activity tag in AndroidManifest.xml file:
android:screenOrientation="portrait"
or this in the activity class:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Solution 2:
Actually you can use config.xml to set it to all devices if you're using PhoneGap Build... Set the propertie: orientation with possible values default, landscape, or portrait example:
< preference name="orientation" value="landscape" />
*please note that default means both landscape and portrait are enabled.
Solution 3:
use this code in your manifest
<activity android:name=".DroidGap"android:label="@string/app_name"android:screenOrientation="landscape" >
Solution 4:
I had to update <path to phonegap app>/platform/android/AndroidManifest.xml
with android:screenOrientation="portrait"
. Set to default, landscape, or portrait.
See below for a full example:
<activityandroid:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"android:label="@string/app_name"android:name="HelloWorld"android:screenOrientation="portrait"android:theme="@android:style/Theme.Black.NoTitleBar"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>
Post a Comment for "How To Fix Screen Orientation To Portrait For My Whole Phonegap App"