Photo by Sara Kurfeß on Unsplash

You have an app that doesn’t look good in landscape mode or for some other reasons you don’t want to support that. Don’t worry, there is a way to totally disable that mode for your app, and fortunately, it’s a very little change.

To make your app only support portrait mode, you have to follow different instructions for each platform.

Android

First, you need to open your project and find the AndroidManifest.xml file in this folder android > app > src > main

Then, edit the following activity element and add the android:screenOrientation=”portrait” to it.

 

IOS

IOS made it even easier, all you need to do can be done from Xcode, as you can see in the picture below.

  1. Open  ios > [Project-Name].xcodeproj file in Xcode.
  2. click on the project name
  3. Then find General (tab) > Deployment Info (section) > device orientation
  4. check the Portrait mode
  5. uncheck Landspace Left and Landscape Right

Xcode general tab

That was all you needed to do, now you can build and run the project to see that the landscape is disabled and the screen won’t rotate when you are inside the app.