Cordova ignores screen orientation lock [duplicate]

心不动则不痛 提交于 2019-12-03 08:24:23

Fixed in Cordova 3.4.1. Now preference orientation works!

<preference name="orientation" value="portrait" />
numediaweb

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;

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

Or use a plugin.

FI prefer to edit the manifest as it is easy.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!