I've found solutions to this for iOS and Android, but I can't find one for the Playbook. Is there a way to use PhoneGap or Zepto to lock the screen into portrait orientation on Playbook, and if so, how?
I've tried using the command <preference name="orientation" value="portrait" />
in config.xml, but it had no effect.
You can achieve it by following steps, if you are using Web Works SDK.
Browse to the "device_templates" directory of BlackBerry WebWorks SDK. This directory is typically found in "[DRIVE]:\InstallDir\BlackBerry WebWorks Packager\device_templates"
Open the "Widget.java" file found in this directory in a text
editor.
Make the below changes in the Widget.java file. The
//MODIFIED CODE indicates the changes done
public Widget(WidgetConfig wConfig) {
_wConfig = wConfig;
initialize();
int directions = net.rim.device.api.system.Display.DIRECTION_PORTRAIT; net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(directions);
// Create PageManager
PageManager pageManager = new PageManager(this, (WidgetConfigImpl) _wConfig);
// push screen
WidgetScreen wScreen = new BrowserFieldScreen(this, pageManager);
pageManager.pushScreens((BrowserFieldScreen)wScreen);
}