Detect screen orientation when Orientation=“portrait”


#1

Hi all, I want my app to always be in portrait so in config.xml file I have this line.

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

Which works just fine.

The problem is I can’t detect screen orientation after that.

I tried with

function doOnOrientationChange() {
    console.log(window.orientation);
}

window.addEventListener('orientationchange', doOnOrientationChange);

doOnOrientationChange();

This code shows me 0 when my phone is in portrait and 180 when it is upside-down BUT nothing when in landscape (not 90 nor -90).

I saw this plugin https://github.com/gbenvenuti/cordova-plugin-screen-orientation which seems to be used by a lot of people, but I can’t make it to work on my iPhone 6S (iOS9), after looking at the issues, it seems that I’m not the only one…

Right now I don’t know where to go so any kind of help would be much appreciated!

You can see my question on SO here http://stackoverflow.com/q/36037514/3789576