How to force landscape mode


#1

When I add the following in the project’s “config.xml” file:

<preference name="orientation" value="landscape" />

The result in file “platforms/android/AndroidManifest.xml” is:

android:screenOrientation="userLandscape"

Instead of:

android:screenOrientation="landscape"

Is there a way to get this value outthere somehow ?
If I change it manually and build - it’s really in landscape mode - but I don’t want to do that …
I’m using Cordova 3.4


#2

Looks like a bug in 3.4.0:
https://issues.apache.org/jira/browse/CB-6312

I’d say these are your options:

  1. Remove the preference and just manually add it to the AndroidManifest
  2. Update Phonegap to 3.5.0
  3. Use a plugin instead: https://github.com/cogitor/PhoneGap-OrientationLock

#3

mmm good to know :slight_smile: I actually have a newer version ( 3.5 ) installed, but I’m not sure how do I upgrade the current-old project ( 3.4 ) to use the new version, you have any idea ?

If not, I’ll do it manually.
Thanks in advance !


#4

Upgrading can mostly be done from the CLI command line interface. These are for 3.3.0 to 3.4.0 but I don’t think any has changed and you can do the same to go to 3.5.0:
https://cordova.apache.org/docs/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface

Depending on how many plugins or how much customization you have done determines how much updating of those you may need to do as well.

I’d just copy your 3.4.0 project so you have a backup and give it a shot.


#5

Cordova on my server is already 3.5, I’ll explain my issue in new thread ( incase others have this issue as well )