I have a problem with setting screen of my app to be in horizontal position. Like in the title. Well, at the very beginning I did it adding this line to the config.xml: <preference name="orientation" value="landscape"/>. The problem is that it works only in one direction. I mean it rotates the screen only to the left. So I decided to use a cordova plugin and I did so. I have used "cordova-plugin-screen-orientation" from npm and I added
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
screen.lockOrientation('landscape');
}
to the index.html. And it works fine. The another problem is that some of my files have this line of code:
function onBackKeyDown() {
navigator.app.exitApp();
}
which turns off the app after clicking this arrow on the android bar. And after clicking this button app is admittedly off but it is still in the RAM and after clicking this button (picture)
you can get back to it and then this plugin doesn't work any more. My app turns to the portrait orientation. And now my question. What can I do to avoid it? Shoud I set it somehow to turn off from the RAM or is there better way to set orientation? Thanks.