Skip to content Skip to sidebar Skip to footer

Cordova Ignores Screen Orientation Lock

I'm using Cordova 3.3.0 with my Galaxy S3 (running latest Cyanogenmod) to test an app I'm working on; I need the app screen to remain in 'portrait' mode and be locked even if the u

Solution 1:

Fixed in Cordova 3.4.1. Now preference orientation works!

<preferencename="orientation"value="portrait" />

Solution 2:

I just found an interesting answer after I posted the question (in the related widget right); It's a bug in Cordova and to fix it, you either edit the AndroidManifest.xml to something like;

<activityandroid:screenOrientation="portrait"android:configChanges=...

Or use a plugin.

FI prefer to edit the manifest as it is easy.

Solution 3:

The solution is to edit the android manifest like this:

    <application
            android:icon="@drawable/icon"
            android:label="@string/app_name" >
            <activity
                android:name=".AppName"
                android:configChanges="orientation|keyboardHidden|screenSize"
                android:label="@string/app_name"
                android:launchMode="singleTask"
                android:screenOrientation="unspecified"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" >

with unspecified android select the proper orientation for device. es. smartphone is portrait only, but tablet is portrait and landscape

Post a Comment for "Cordova Ignores Screen Orientation Lock"