apache/cordova-plugin-device-orientation — pull request #16 by tisztamo (2014-10-23 14:38:08+00:00)
Title: Fixed invalid orientation reports on iOS related to landscape mode

The iOS plugin sets the locationManager.headingOrientation at the first heading request but later it doesn't adapt to (screen) orientation changes while the heading watch is running which causes invalid reports when the first request happens in landscape orientation.

The fix is just removing this setting.

### Note 1
The documentation is not clear about the plugin behaviour at screen orientation changes. The only place where it talks about this question is at iOS quirks:

*"For iOS 4 devices and above, heading factors in the device's current orientation, and does not reference its absolute position, for apps that supports that orientation."*

This feature is not working correctly and being not compatible with other platforms it just creates unneeded hassle for the user. At the time both Android and iOS versions behave the same: nothing happens at orientation change. This is how the native sensor APIs are working too so I think that removing this is the correct fix of the problem.

I have removed this from the documentation too.

### Note 2
To correct the reported value based on screen orientation the user can do something like (Do not use the % operator because of this: http://wiki.ecmascript.org/doku.php?id=strawman:modulo_operator ):

var corrected = heading + window.orientation;
if (corrected < 0) {
corrected += 360;
} else if (corrected >= 360) {
corrected -= 360;
}

I haven't updated the documentation with this but I suggest to include this info