Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit orientation in metro apps?

In my app, all of the stuff is only in Landscape mode. I don't want the app to be functional in Portrait mode. How do I limit the orientation?

Thanks.

like image 881
indiaxxo Avatar asked Sep 27 '12 05:09

indiaxxo


People also ask

How do I lock my app orientation?

On the main screen of Rotation Manager, select an orientation by tapping on either the vertical or horizontal icons next to a specific app to lock it into either landscape or portrait mode. Highlighting both icons will allow that particular app to auto-rotate.

How do I lock portrait orientation on Android?

If you don't want the screen to switch between portrait and landscape when you move the device, you can lock the screen orientation. To do this, swipe down from the right side of the top panel. Hold the device in the orientation in which you want it locked.

How do I force an app to rotate?

Android Settings Start by going to Settings => Display and locate the “Device rotation” setting. On my personal cell phone, tapping this will reveal two options: “Rotate the contents of the screen,” and “Stay in portrait view.”


2 Answers

As explained in this link the orientation limitation preference setting of the app is only enforced on a Windows 8 system with a supported HARDWARE ACCELEROMETER. This means that unless Windows knows how the system is orientated through the means of a supported sensor, it will not attempt to switch to the app's preferred orientation.

So it will all depend on the user's hardware.

like image 143
Mamta D Avatar answered Oct 06 '22 19:10

Mamta D


I had this problem as well as I wanted to constrain my game to only landscape mode. I put this in my OnLaunched handler for App.xaml:

        Windows.Graphics.Display.DisplayProperties.AutoRotationPreferences =
            Windows.Graphics.Display.DisplayOrientations.Landscape;

However I noted that in the simulator it seemed to ignore this whereas on the hardware tablet I tested on it seemed to behave appropriately. The AutoRotationPreferences are bit flags so you can or together all the orientations you want to allow.

like image 24
RobCurr Avatar answered Oct 06 '22 20:10

RobCurr