Lock screen orientation


#1

How can i lock screen orientation?
I need to stay in vertical.


#2

Add this line to your config.xml file:

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

#3

Or you can do this programmatically using net.yoik.cordova.plugins.screenorientation Cordova plugin.

It’s as simple as this:

            screen.lockOrientation('landscape');

            screen.lockOrientation('portrait');

Read more about it here, there’s also a working example you can play with: http://www.gajotres.net/changing-locking-screen-orientation-in-ionic-application/