Ok, so I got it: The reason Phonegap ignored the <preference name="orientation" value="portrait" />
in the config.xml
file is because my app was in debug mode. once I created a release version it stopped from going to landscape.
How to prevent a Phonegap application to switch to landscape view
-
23-07-2023 - |
Вопрос
This one should be very simple, however it's not. I'm trying to prevent my application from going into landscape view so I've changed the config.xml
file like this: <preference name="orientation" value="portrait" />
. Unfortunately, it's not working. Any ideas?
Решение
Другие советы
Small piece of code and here you go. Try it.
<preference name="orientation" value="portrait" />
hello you can install this plugin https://github.com/gbenvenuti/cordova-plugin-screen-orientation
and add this function on you index.js or one of your first executed js document
window.addEventListener("orientationchange", function(){
screen.lockOrientation('portrait');
});
thank u
For platform android just set prefered orientation in androidManifest.xml like this
<activity
android:name="com.payoda.Insurance.SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar"
>
</activity>
For IOS the following link may help you
Не связан с StackOverflow