The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

Windows Phone 8(.1) versus Windows 8(.1) Accelerometer Orientation RRS feed

  • Question

  • I'm hoping someone can authoritatively confirm what I'm observing so that I don't release some apps that include a false assumption and break on some devices.

    From experimentation, and ultimately some extensive web poking around, the concept of "sensors standard orientation" is different between Windows Phone 8(.1) and Windows 8(.1) (such as on the Surface).  Can someone reasonably authoritatively confirm this for me?  Perchance with a reference to any Microsoft documentation that acknowledges it.

    There is an MSDN page that talks about the sensors orientation being standardized on all devices regardless of native orientation, but that page isn't clear about whether it is intended to apply to Windows Phone devices.  After experimentation, some lengthy web research, and a LOT of head scratching, I've come to believe that web page really just means all "Windows 8 tablet devices" and is NOT meant to include Windows Phone devices.

    That page states when the device is held in normal landscape orientation, the accelerometer +X reading is oriented toward the right and the accelerometer +Y reading is oriented toward the top.  This remains true regardless of whether the device is designed as landscape-first or portrait-first.

    Landscape-first would be like the Surface where the Windows button is at the bottom when holding the device in a landscape orientation.  Portrait-first would be a device where the Windows button is at the bottom when holding the device in portrait orientation.  I guess many of the smaller 7"/8" tablets tend toward portrait-first.  Portrait-first devices, WHEN HELD IN LANDSCAPE, still have +X oriented toward the right, and +Y orientated toward the top.

    Even though typical Windows Phones could easily be viewed as portrait-first devices, my understanding is this orientation standardization does NOT apply to Windows Phones.  Instead, the "standard" for Windows Phones is, when held in PORTRAIT orientation, for +X toward the right, and for +Y toward the top. The best confirmation I've found of this Windows Phone sensor orientation standard is this Microsoft video on YouTube.  If someone could provide a link to written web documentation that discusses the standardized sensor orientation for Windows Phones, that would be MUCH appreciated.

    So in summary... can someone confirm:

    #1. The Windows Phone sensor standard orientation is DIFFERENT than Windows (tablet) sensor standard orientation.

    #2. The Windows Phone standard holds for all Windows (8+) phones.

    #3. The Windows (tablet) standard holds for all Windows (8+) device (tablets) with sensors.

    #4. (Which is really what this all boils down to) When writing a universal app, simply using the WINDOWS_APP and WINDOWS_PHONE_APP compilation symbols to select between the two orientation standards is sufficient to then support all Windows and Windows Phone devices.


    -- kburgoyne

    • Edited by kburgoyne Thursday, January 15, 2015 1:09 AM Typo
    Thursday, January 15, 2015 12:17 AM

All replies

  • I have not too much experience on this area, maybe these two references can help you:

    Best Regards,
    Please remember to mark the replies as answers if they help

    Thursday, January 15, 2015 9:45 AM
  • Thank you for your kind efforts to assist.

    Once I went to the second link, I remembered coming across it before. The main problem with both code examples, as is the case with all the accelerometer code examples I found, is the code makes no effort to orient the sensor readings to how the user is holding the phone.  The examples are typically just straight-forward and display the reading numbers without attempting to interpret how they're oriented.

    I wrote such an app myself that reports the readings from ALL sensors when I first started playing with the sensors.  Such apps helped to show me the readings on a Surface Pro (2) were oriented 90 degrees from the readings on a Nokia Icon (phone).  In other words holding the Surface Pro in landscape oriented the X and Y readings left/right and up/down.  However holding the Icon in portrait was necessary to produce the same results.

    From an engineering standpoint, doing things "proper" means finding a specification that confirms what I'm observing between the Surface and Icon is "to spec" and not some kind of anomaly that will come back and bite me if I release some apps people start using on other devices. 

    -- kburgoyne

    Thursday, January 15, 2015 6:30 PM