As this scenario is not very common, there isn't a straight-forward approach that can work for the different platforms. However, there are certain implementations developed for each platform.
For instance, starting in PhoneGap 0.9.5
there's an undocumented iOS
only feature that allows you to handle whether the device should rotate to a particular orientation. It exposes the iOS Objective-C method shouldAutorotateToInterfaceOrientation
. Please take a look at the iOS: shouldAutorotateToInterfaceOrientation / Lock Orientation in PhoneGap
post for more information on how to take advantage of that method to prevent the rotation of a page.
, on the other hand, I found a custom plugin - OrientationLock
, which supports Cordova 3.0+ and is Plugman
-compatible. You can follow the steps described in the Import Custom Plugins
tutorial to import the plugin in an AppBuilder
project. However, please note that while I tested this plugin locally, I was able to lock the screen orientation to "portrait"-only but I was not able to unlock it back. This is why I had to slightly change the implementation of the plugin. In the OrientationLock.java
file, I modified the Activity Orientation
to be reset to SCREEN_ORIENTATION_SENSOR
instead of SCREEN_ORIENTATION_UNSPECIFIED
Please note that I haven't tested these approaches extensively, which means that you might have to further research the topic and implement an approach that best meets your needs. Also, as both solution work with the orientation of the app, rather than a specific view, I would recommend using them in events indicating that you have navigated to or away from a specific view.
I hope the provided information can get you started.
Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!