locked
Supported Orientations in HTML/JS RRS feed

  • Question

  • Hello!

    How to define Supported Orientations in HTML/JS devending on device type (PC/Tablet)?


    Microsoft Student Partner

    Sunday, April 29, 2012 8:24 AM

Answers

  • Hi Aleksey,

    You can set the orientations you support two ways:

    1. Using the DisplayProperties.AutoRotationPreferences API. This API can be called at runtime to change your apps supported orientations.
    2. In the app's manifest file, select the orientations you wish to support in the "supported initial rotation(s)" field. This setting is applied as the default rotation preference when your app is started and remains for the entire session (unless you change it at runtime via the API above).

    Important things to keep in mind:

    • The supported orientation only applies to devices with accelerometers (if you specify that your app supports Portrait only, your app will still be shown in Landscape on a desktop).
    • Even on devices without accelerometers, users can always set the orientation using the control panel (Control Panel\Appearance and Personalization\Display\Screen Resolution). This means that it is always possible that your app will be viewed in any of the four orientations. This is why the orientation setting you can use is called a "preference." You are never guaranteed your app will only be viewed in those orientations.

    Justin Cooperman

    Tuesday, May 1, 2012 10:57 PM

All replies

  • I think the recommendation is to support all possible orientations and views in some way using CSS3 media queries.  Blend is helpful in displaying what the app will look like in any configuration.

    However, if your app requires a specific orientation, there may be a solution.  See this unresolved thread on the UI forum.

    Sunday, April 29, 2012 12:42 PM
  • Hi,

    like said above you should try to support all orientations, but if you only want to support some orientations you can specify them in the manifest file of the app.


    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Sunday, April 29, 2012 11:51 PM
  • Hi Aleksey,

    You can set the orientations you support two ways:

    1. Using the DisplayProperties.AutoRotationPreferences API. This API can be called at runtime to change your apps supported orientations.
    2. In the app's manifest file, select the orientations you wish to support in the "supported initial rotation(s)" field. This setting is applied as the default rotation preference when your app is started and remains for the entire session (unless you change it at runtime via the API above).

    Important things to keep in mind:

    • The supported orientation only applies to devices with accelerometers (if you specify that your app supports Portrait only, your app will still be shown in Landscape on a desktop).
    • Even on devices without accelerometers, users can always set the orientation using the control panel (Control Panel\Appearance and Personalization\Display\Screen Resolution). This means that it is always possible that your app will be viewed in any of the four orientations. This is why the orientation setting you can use is called a "preference." You are never guaranteed your app will only be viewed in those orientations.

    Justin Cooperman

    Tuesday, May 1, 2012 10:57 PM