Phonegap Disable Screen Rotate On Single Page?

I am using PhoneGap and I am working with an Android web application.

How to disable screen rotation for only one page?

I was looking for this solution, but all solutions say disabling screen rotation in the AndroidManifest.xml file. However, this disables rotation for the entire application. I need to turn off rotation for only one page.

Can this be done using PhoneGap / Javascript code? I do not use Java code.

Thanks.

+6
source share
3 answers

I know this post is a few months old, but there is a plug-in for the telephone plug that can help you ... This is a plugin that can lock or unlock the screen orientation.

OrientationLock - Android PhoneGap

+4
source

You can simply remove the following tag or set it to 'portrait' in the config.xml file:

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

For more information, read the documentation by phone:

https://build.phonegap.com/docs/config-xml

+5
source

This is an easy way to block rotation:

1/. Change in config.xml file:

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

2 /. Put this code in the Android Manifestxml file in:

 <activity> ... android:screenOrientation="portrait" ... </activity> 
+2
source

Source: https://habr.com/ru/post/914402/


All Articles