cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tisztamo <>
Subject [GitHub] cordova-plugin-device-orientation pull request: Fixed invalid orie...
Date Thu, 23 Oct 2014 14:38:11 GMT
GitHub user tisztamo opened a pull request:

    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:
    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

You can merge this pull request into a Git repository by running:

    $ git pull fixiosorientation

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16
commit 0623d82f8f5e298d98f7967d0b518bc11cc68c7a
Author: ko <>
Date:   2014-10-23T13:52:32Z

    Fixed invalid heading reports on iOS when the first request is initiated in landscape

commit 8adaa2367a22fedd4426e5575d2d5bb29d1f5399
Author: ko <>
Date:   2014-10-23T14:30:20Z

    Removed the ios orientation quirk from the documentation


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message