---
description: Capacitor plugin to lock the screen orientation of the app. It allows you to set the orientation to portrait, landscape, or any other supported mode.
title: Capacitor Screen Orientation Plugin - Capawesome
image: https://capawesome.io/docs/assets/images/social/sdks/capacitor/screen-orientation.png
---

<!doctype html> 

[Skip to content ](#capacitor-screen-orientation-plugin) 

[🔐 Introducing the **Capacitor Vault** plugin — store secrets behind biometrics or a device passcode. ](/blog/announcing-the-capacitor-vault-plugin/) 

* [ SDKs ](/docs/sdks/)
* [ Formbricks ](/docs/sdks/capacitor/formbricks/)
* [ Geocoder ](/docs/sdks/capacitor/geocoder/)
* [ Google Sign-In ](/docs/sdks/capacitor/google-sign-in/)
* [ Grafana Faro ](/docs/sdks/capacitor/grafana-faro/)
* [ Gyroscope ](/docs/sdks/capacitor/gyroscope/)
* [ Haptics ](/docs/sdks/capacitor/haptics/)
* [ Home Indicator ](/docs/sdks/capacitor/home-indicator/)
* [ In-App Browser ](/docs/sdks/capacitor/in-app-browser/)
* [ Install Referrer ](/docs/sdks/capacitor/install-referrer/)
* [ Keep Awake ](/docs/sdks/capacitor/keep-awake/)
* [ libSQL ](/docs/sdks/capacitor/libsql/)
* [ Light Sensor ](/docs/sdks/capacitor/light-sensor/)
* [ Live Update ](/docs/sdks/capacitor/live-update/)
* [ Localization ](/docs/sdks/capacitor/localization/)
* [ Mail Composer ](/docs/sdks/capacitor/mail-composer/)
* [ Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [ Maps Launcher ](/docs/sdks/capacitor/maps-launcher/)
* [ Media Session ](/docs/sdks/capacitor/media-session/)
* [ ML Kit ](/docs/sdks/capacitor/mlkit/)
* [ Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [ Network ](/docs/sdks/capacitor/network/)
* [ NFC ](/docs/sdks/capacitor/nfc/)
* [ Node.js ](/docs/sdks/capacitor/nodejs/)
* [ OAuth ](/docs/sdks/capacitor/oauth/)
* [ Passkeys ](/docs/sdks/capacitor/passkeys/)
* [ Password Autofill ](/docs/sdks/capacitor/password-autofill/)
* [ PDF Generator ](/docs/sdks/capacitor/pdf-generator/)
* [ PDF Viewer ](/docs/sdks/capacitor/pdf-viewer/)
* [ Pedometer ](/docs/sdks/capacitor/pedometer/)
* [ Permissions ](/docs/sdks/capacitor/permissions/)
* [ Phone Dialer ](/docs/sdks/capacitor/phone-dialer/)
* [ Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [ Photo Manipulator ](/docs/sdks/capacitor/photo-manipulator/)
* [ PixLive ](/docs/sdks/capacitor/pixlive/)
* [ PostHog ](/docs/sdks/capacitor/posthog/)
* [ Printer ](/docs/sdks/capacitor/printer/)
* [ Privacy Screen ](/docs/sdks/capacitor/privacy-screen/)
* [ Proximity Sensor ](/docs/sdks/capacitor/proximity-sensor/)
* [ Purchases ](/docs/sdks/capacitor/purchases/)
* [ RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [ Root Detection ](/docs/sdks/capacitor/root-detection/)
* [ Screen Brightness ](/docs/sdks/capacitor/screen-brightness/)
* Screen Orientation [ Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ Enums ](#enums)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)
* [ Credits ](#credits)
* [ Screen Reader ](/docs/sdks/capacitor/screen-reader/)
* [ Screenshot ](/docs/sdks/capacitor/screenshot/)
* [ Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [ Settings Launcher ](/docs/sdks/capacitor/settings-launcher/)
* [ Shake ](/docs/sdks/capacitor/shake/)
* [ Silent Mode ](/docs/sdks/capacitor/silent-mode/)
* [ SIM ](/docs/sdks/capacitor/sim/)
* [ SMS Composer ](/docs/sdks/capacitor/sms-composer/)
* [ Speech Recognition ](/docs/sdks/capacitor/speech-recognition/)
* [ Speech Synthesis ](/docs/sdks/capacitor/speech-synthesis/)
* [ Share Target ](/docs/sdks/capacitor/share-target/)
* [ Square Mobile Payments ](/docs/sdks/capacitor/square-mobile-payments/)
* [ SQLite ](/docs/sdks/capacitor/sqlite/)
* [ Superwall ](/docs/sdks/capacitor/superwall/)
* [ System WebView ](/docs/sdks/capacitor/system-webview/)
* [ Text Interaction ](/docs/sdks/capacitor/text-interaction/)
* [ Text Zoom ](/docs/sdks/capacitor/text-zoom/)
* [ Thermal State ](/docs/sdks/capacitor/thermal-state/)
* [ Toast ](/docs/sdks/capacitor/toast/)
* [ Torch ](/docs/sdks/capacitor/torch/)
* [ Vault ](/docs/sdks/capacitor/vault/)
* [ Volume ](/docs/sdks/capacitor/volume/)
* [ Wallet ](/docs/sdks/capacitor/wallet/)
* [ Wifi ](/docs/sdks/capacitor/wifi/)
* [ Zip ](/docs/sdks/capacitor/zip/)
* [ Cordova ](/docs/sdks/cordova/)
* [ Cloud ](/docs/cloud/)
* [ Integrations ](/docs/cloud/live-updates/integrations/)
* Concepts
* Reference
* [ Troubleshooting ](/docs/cloud/live-updates/troubleshooting/)
* [ FAQ ](/docs/cloud/live-updates/faq/)
* [ Native Builds ](/docs/cloud/native-builds/)
* [ Set Up Environments ](/docs/cloud/native-builds/environments/)
* [ Overwrite Native Configurations ](/docs/cloud/native-builds/native-configurations/)
* [ Auto-Increment Build Numbers ](/docs/cloud/native-builds/auto-incrementing-build-numbers/)
* [ Configure the Web Build Script ](/docs/cloud/native-builds/web-build-script/)
* [ Build from a Monorepo ](/docs/cloud/native-builds/monorepo/)
* [ Use pnpm, Yarn, or bun ](/docs/cloud/native-builds/package-managers/)
* [ Install Private npm Packages ](/docs/cloud/native-builds/npm-private-registry/)
* [ Override the Java Version ](/docs/cloud/native-builds/override-java-version/)
* [ Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/custom-ios-provisioning-profiles/)
* [ Build without Git ](/docs/cloud/native-builds/build-without-git/)
* [ Access Git Behind a Firewall ](/docs/cloud/native-builds/firewall-access/)
* [ Integrations ](/docs/cloud/native-builds/integrations/)
* Reference
* [ Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [ FAQ ](/docs/cloud/native-builds/faq/)
* [ App Store Publishing ](/docs/cloud/app-store-publishing/)
* [ Submit a Build ](/docs/cloud/app-store-publishing/submit-a-build/)
* [ Submit Automatically After a Build ](/docs/cloud/app-store-publishing/submit-automatically/)
* [ Troubleshooting ](/docs/cloud/app-store-publishing/troubleshooting/)
* [ FAQ ](/docs/cloud/app-store-publishing/faq/)
* [ Automations ](/docs/cloud/automations/)
* [ Reference ](/docs/cloud/automations/reference/)
* [ Troubleshooting ](/docs/cloud/automations/troubleshooting/)
* [ FAQ ](/docs/cloud/automations/faq/)
* [ Assist ](/docs/cloud/assist/)
* [ CLI ](/docs/cloud/cli/)
* APIs and SDKs
* [ Webhooks ](/docs/cloud/webhooks/)
* [ Integrations ](/docs/cloud/integrations/)
* Account
* [ Organization ](/docs/cloud/organizations/)
* [ Two-Factor Enforcement ](/docs/cloud/organizations/two-factor-authentication/)
* [ Audit Logs ](/docs/cloud/organizations/audit-logs/)
* [ Billing ](/docs/cloud/organizations/billing/)
* [ License Keys ](/docs/cloud/license-keys/)
* [ AI ](/docs/ai/)
* [ Insiders ](/docs/insiders/)
* [ Billing & Plans ](/docs/insiders/billing-and-plans/)
* [ FAQ ](/docs/insiders/faq/)
* [ License ](https://capawesome.io/legal/eula/)
* [ Support ](/docs/support/)
* [ Contributing ](/docs/contributing/)
* Contributing code
* [ Code of Conduct ](/docs/contributing/code-of-conduct/)
* [ Questions ](https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion#creating-a-discussion)
* [ Blog ](/blog/)
* Categories

* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ Enums ](#enums)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)
* [ Credits ](#credits)

# Capacitor Screen Orientation Plugin[¶](#capacitor-screen-orientation-plugin "Permanent link")

Capacitor plugin to lock/unlock the screen orientation.

[ ![Deliver Live Updates to your Capacitor app with Capawesome Cloud](../../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](https://cloud.capawesome.io/) 

## Features[¶](#features "Permanent link")

The Capacitor Screen Orientation plugin is one of the most complete orientation control solutions for Capacitor apps. Here are some of the key features:

* 🖥️ **Cross-platform**: Supports Android, iOS, and Web.
* 🔒 **Orientation locking**: Lock screen to specific orientations.
* 🔓 **Orientation unlocking**: Unlock and restore automatic orientation.
* 📱 **Multiple orientations**: Support for portrait, landscape, and specific orientations.
* 🔄 **Orientation detection**: Get current screen orientation.
* 📢 **Event listeners**: Listen to orientation change events.
* 📐 **Fine-grained control**: Primary and secondary orientation modes.
* 🍎 **iPad support**: Special configuration for iPad orientation locking.
* 🔁 **Up-to-date**: Always supports the latest Capacitor version.

Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!

## Use Cases[¶](#use-cases "Permanent link")

The Screen Orientation plugin is typically used whenever certain screens of an app only work well in a specific orientation, for example:

* **Video players**: Lock the screen to landscape for fullscreen video playback.
* **Games**: Keep the game in a fixed orientation regardless of how the device is held.
* **Camera and scanner screens**: Lock the screen to portrait while capturing photos or scanning codes.
* **Forms and reading views**: Prevent accidental rotation while the user is typing or reading.
* **Responsive layouts**: React to orientation changes with the `screenOrientationChange` event to adapt your UI.

## Compatibility[¶](#compatibility "Permanent link")

| Plugin Version | Capacitor Version | Status         |
| -------------- | ----------------- | -------------- |
| 8.x.x          | \>=8.x.x          | Active support |
| 7.x.x          | 7.x.x             | Deprecated     |
| 6.x.x          | 6.x.x             | Deprecated     |
| 5.x.x          | 5.x.x             | Deprecated     |

## Installation[¶](#installation "Permanent link")

You can use our **AI-Assisted Setup** to install the plugin. Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:

`[](#%5F%5Fcodelineno-0-1)npx skills add capawesome-team/skills --skill capacitor-plugins
`

Then use the following prompt:

`` [](#%5F%5Fcodelineno-1-1) Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-screen-orientation` plugin in my project.
 ``

If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:

`[](#%5F%5Fcodelineno-2-1)npm install @capawesome/capacitor-screen-orientation
[](#%5F%5Fcodelineno-2-2)npx cap sync
`

### iOS[¶](#ios "Permanent link")

#### General[¶](#general "Permanent link")

On iOS you must add the following to your app's `AppDelegate.swift`:

`[](#%5F%5Fcodelineno-3-1)+ import ScreenOrientationPlugin
[](#%5F%5Fcodelineno-3-2)
[](#%5F%5Fcodelineno-3-3)@UIApplicationMain
[](#%5F%5Fcodelineno-3-4)class AppDelegate: UIResponder, UIApplicationDelegate {
[](#%5F%5Fcodelineno-3-5)
[](#%5F%5Fcodelineno-3-6)+ func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
[](#%5F%5Fcodelineno-3-7)+   return ScreenOrientation.getSupportedInterfaceOrientations()
[](#%5F%5Fcodelineno-3-8)+ }
`

If your project still uses CocoaPods instead of Swift Package Manager (SPM), import `CapawesomeCapacitorScreenOrientation` rather than `ScreenOrientationPlugin`:

`[](#%5F%5Fcodelineno-4-1)+ import CapawesomeCapacitorScreenOrientation
`

#### iPad Orientation Lock[¶](#ipad-orientation-lock "Permanent link")

On iPad, you must add the following to your app's `Info.plist`:

`[](#%5F%5Fcodelineno-5-1)<key>UIRequiresFullScreen</key>
[](#%5F%5Fcodelineno-5-2)<true/>
`

## Configuration[¶](#configuration "Permanent link")

No configuration required for this plugin.

## Demo[¶](#demo "Permanent link")

A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)

## Usage[¶](#usage "Permanent link")

The following examples show how to lock, unlock, and read the current screen orientation.

### Lock the screen orientation[¶](#lock-the-screen-orientation "Permanent link")

Lock the device to a specific orientation, for example landscape. Besides `LANDSCAPE` and `PORTRAIT`, you can also lock to a primary or secondary mode such as `LANDSCAPE_PRIMARY` for fine-grained control:

`[](#%5F%5Fcodelineno-6-1)import { ScreenOrientation, OrientationType } from '@capawesome/capacitor-screen-orientation';
[](#%5F%5Fcodelineno-6-2)
[](#%5F%5Fcodelineno-6-3)const lock = async () => {
[](#%5F%5Fcodelineno-6-4)  await ScreenOrientation.lock({ type: OrientationType.LANDSCAPE });
[](#%5F%5Fcodelineno-6-5)};
`

### Unlock the screen orientation[¶](#unlock-the-screen-orientation "Permanent link")

Remove the orientation lock and restore automatic rotation:

`[](#%5F%5Fcodelineno-7-1)import { ScreenOrientation } from '@capawesome/capacitor-screen-orientation';
[](#%5F%5Fcodelineno-7-2)
[](#%5F%5Fcodelineno-7-3)const unlock = async () => {
[](#%5F%5Fcodelineno-7-4)  await ScreenOrientation.unlock();
[](#%5F%5Fcodelineno-7-5)};
`

### Get the current screen orientation[¶](#get-the-current-screen-orientation "Permanent link")

Read the current orientation type of the device:

`[](#%5F%5Fcodelineno-8-1)import { ScreenOrientation } from '@capawesome/capacitor-screen-orientation';
[](#%5F%5Fcodelineno-8-2)
[](#%5F%5Fcodelineno-8-3)const getCurrentOrientation = async () => {
[](#%5F%5Fcodelineno-8-4)  const result = await ScreenOrientation.getCurrentOrientation();
[](#%5F%5Fcodelineno-8-5)  return result.type;
[](#%5F%5Fcodelineno-8-6)};
`

## API[¶](#api "Permanent link")

* [lock(...)](#lock)
* [unlock()](#unlock)
* [getCurrentOrientation()](#getcurrentorientation)
* [addListener('screenOrientationChange', ...)](#addlistenerscreenorientationchange-)
* [removeAllListeners()](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)

### lock(...)[¶](#lock "Permanent link")

`[](#%5F%5Fcodelineno-9-1)lock(options?: LockOptions | undefined) => Promise<void>
`

Locks the device orientation.

| Param       | Type                        |
| ----------- | --------------------------- |
| **options** | [LockOptions](#lockoptions) |

---

### unlock()[¶](#unlock "Permanent link")

`[](#%5F%5Fcodelineno-10-1)unlock() => Promise<void>
`

Unlocks the device orientation.

---

### getCurrentOrientation()[¶](#getcurrentorientation "Permanent link")

`[](#%5F%5Fcodelineno-11-1)getCurrentOrientation() => Promise<GetCurrentOrientationResult>
`

Gets the current device orientation type.

**Returns:** `Promise<[GetCurrentOrientationResult](#getcurrentorientationresult)>`

---

### addListener('screenOrientationChange', ...)[¶](#addlistenerscreenorientationchange "Permanent link")

`[](#%5F%5Fcodelineno-12-1)addListener(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener) => Promise<PluginListenerHandle>
`

Listen for screen orientation changes.

| Param            | Type                                                                |
| ---------------- | ------------------------------------------------------------------- |
| **eventName**    | 'screenOrientationChange'                                           |
| **listenerFunc** | [ScreenOrientationChangeListener](#screenorientationchangelistener) |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

---

### removeAllListeners()[¶](#removealllisteners "Permanent link")

`[](#%5F%5Fcodelineno-13-1)removeAllListeners() => Promise<void>
`

Remove all listeners for this plugin.

---

### Interfaces[¶](#interfaces "Permanent link")

#### LockOptions[¶](#lockoptions "Permanent link")

| Prop     | Type                                | Description                |
| -------- | ----------------------------------- | -------------------------- |
| **type** | [OrientationType](#orientationtype) | The orientation lock type. |

#### GetCurrentOrientationResult[¶](#getcurrentorientationresult "Permanent link")

| Prop     | Type                                | Description                   |
| -------- | ----------------------------------- | ----------------------------- |
| **type** | [OrientationType](#orientationtype) | The current orientation type. |

#### PluginListenerHandle[¶](#pluginlistenerhandle "Permanent link")

| Prop       | Type                |
| ---------- | ------------------- |
| **remove** | () => Promise<void> |

#### ScreenOrientationChange[¶](#screenorientationchange "Permanent link")

| Prop     | Type                                | Description                   |
| -------- | ----------------------------------- | ----------------------------- |
| **type** | [OrientationType](#orientationtype) | The current orientation type. |

### Type Aliases[¶](#type-aliases "Permanent link")

#### ScreenOrientationChangeListener[¶](#screenorientationchangelistener "Permanent link")

Callback to receive the screen orientation change notifications.

`(change: [ScreenOrientationChange](#screenorientationchange)): void`

### Enums[¶](#enums "Permanent link")

#### OrientationType[¶](#orientationtype "Permanent link")

| Members                  | Value                 | Description                                                         |
| ------------------------ | --------------------- | ------------------------------------------------------------------- |
| **LANDSCAPE**            | 'landscape'           | The orientation is either landscape-primary or landscape-secondary. |
| **LANDSCAPE\_PRIMARY**   | 'landscape-primary'   | The orientation is in the primary landscape mode.                   |
| **LANDSCAPE\_SECONDARY** | 'landscape-secondary' | The orientation is in the secondary landscape mode.                 |
| **PORTRAIT**             | 'portrait'            | The orientation is either portrait-primary or portrait-secondary.   |
| **PORTRAIT\_PRIMARY**    | 'portrait-primary'    | The orientation is in the primary portrait mode.                    |
| **PORTRAIT\_SECONDARY**  | 'portrait-secondary'  | The orientation is in the secondary portrait mode.                  |

## FAQ[¶](#faq "Permanent link")

### Why does the orientation lock not work on iPad?[¶](#why-does-the-orientation-lock-not-work-on-ipad "Permanent link")

For the orientation lock to work on iPad, you must add the `UIRequiresFullScreen` key with the value `true` to your app's `Info.plist` file, as described in the [Installation](#installation) section. Also make sure that you have applied the required changes to your `AppDelegate.swift`.

### Do I need to modify my AppDelegate on iOS?[¶](#do-i-need-to-modify-my-appdelegate-on-ios "Permanent link")

Yes. You must implement the `supportedInterfaceOrientationsFor` method in your app's `AppDelegate.swift` and return `ScreenOrientation.getSupportedInterfaceOrientations()`, as shown in the [Installation](#installation) section. Without this change, the orientation lock has no effect on iOS.

### What is the difference between LANDSCAPE and LANDSCAPE\_PRIMARY?[¶](#what-is-the-difference-between-landscape-and-landscape%5Fprimary "Permanent link")

The `LANDSCAPE` type covers both landscape modes, so the device can be rotated between landscape-primary and landscape-secondary while locked. The `LANDSCAPE_PRIMARY` and `LANDSCAPE_SECONDARY` types lock the screen to exactly one of the two landscape modes. The same applies to `PORTRAIT`, `PORTRAIT_PRIMARY` and `PORTRAIT_SECONDARY`.

### How do I restore automatic rotation after locking the orientation?[¶](#how-do-i-restore-automatic-rotation-after-locking-the-orientation "Permanent link")

Simply call the `unlock()` method. It removes the orientation lock so that the device rotates automatically again based on the user's device settings.

### How can I react to orientation changes?[¶](#how-can-i-react-to-orientation-changes "Permanent link")

Add a listener for the `screenOrientationChange` event using the `addListener(...)` method. The listener receives the new orientation type every time the screen orientation changes. Use `removeAllListeners()` to remove all listeners when you no longer need them.

### Can I use this plugin with Ionic, React, Vue or Angular?[¶](#can-i-use-this-plugin-with-ionic-react-vue-or-angular "Permanent link")

Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.

## Related Plugins[¶](#related-plugins "Permanent link")

* [Keep Awake](https://capawesome.io/docs/sdks/capacitor/keep-awake/): Keep the screen awake, for example during video playback.
* [Screen Brightness](https://capawesome.io/docs/sdks/capacitor/screen-brightness/): Read and control the screen brightness.
* [Home Indicator](https://capawesome.io/docs/sdks/capacitor/home-indicator/): Hide and show the iOS home indicator.
* [Navigation Bar](https://capawesome.io/docs/sdks/capacitor/navigation-bar/): Set the background color and button style of the Android navigation bar.

## Newsletter[¶](#newsletter "Permanent link")

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).

## Changelog[¶](#changelog "Permanent link")

See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/screen-orientation/CHANGELOG.md).

## License[¶](#license "Permanent link")

See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/screen-orientation/LICENSE).

## Credits[¶](#credits "Permanent link")

This plugin is based on the [Capacitor Screen Orientation](https://github.com/capawesome-team/capacitor-screen-orientation) plugin. Thanks to everyone who contributed to the project!

July 8, 2026 

Back to top

```json
{"@context": "https://schema.org", "@graph": [{"@type": "TechArticle", "@id": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/#article", "headline": "Capacitor Screen Orientation Plugin", "name": "Capacitor Screen Orientation Plugin", "description": "Capacitor plugin to lock the screen orientation of the app. It allows you to set the orientation to portrait, landscape, or any other supported mode.", "inLanguage": "en", "url": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/", "mainEntityOfPage": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "about": {"@id": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/#software"}}, {"@type": "SoftwareSourceCode", "@id": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/#software", "name": "Capacitor Screen Orientation Plugin", "description": "Capacitor plugin to lock the screen orientation of the app. It allows you to set the orientation to portrait, landscape, or any other supported mode.", "url": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/", "programmingLanguage": "TypeScript", "runtimePlatform": "Capacitor", "codeRepository": "https://github.com/capawesome-team", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}}]}
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Why does the orientation lock not work on iPad?", "acceptedAnswer": {"@type": "Answer", "text": "For the orientation lock to work on iPad, you must add the UIRequiresFullScreen key with the value true to your app's Info.plist file, as described in the Installation section. Also make sure that you have applied the required changes to your AppDelegate.swift."}}, {"@type": "Question", "name": "Do I need to modify my AppDelegate on iOS?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. You must implement the supportedInterfaceOrientationsFor method in your app's AppDelegate.swift and return ScreenOrientation.getSupportedInterfaceOrientations(), as shown in the Installation section. Without this change, the orientation lock has no effect on iOS."}}, {"@type": "Question", "name": "What is the difference between LANDSCAPE and LANDSCAPE_PRIMARY?", "acceptedAnswer": {"@type": "Answer", "text": "The LANDSCAPE type covers both landscape modes, so the device can be rotated between landscape-primary and landscape-secondary while locked. The LANDSCAPE_PRIMARY and LANDSCAPE_SECONDARY types lock the screen to exactly one of the two landscape modes. The same applies to PORTRAIT, PORTRAIT_PRIMARY and PORTRAIT_SECONDARY."}}, {"@type": "Question", "name": "How do I restore automatic rotation after locking the orientation?", "acceptedAnswer": {"@type": "Answer", "text": "Simply call the unlock() method. It removes the orientation lock so that the device rotates automatically again based on the user's device settings."}}, {"@type": "Question", "name": "How can I react to orientation changes?", "acceptedAnswer": {"@type": "Answer", "text": "Add a listener for the screenOrientationChange event using the addListener(...) method. The listener receives the new orientation type every time the screen orientation changes. Use removeAllListeners() to remove all listeners when you no longer need them."}}, {"@type": "Question", "name": "Can I use this plugin with Ionic, React, Vue or Angular?", "acceptedAnswer": {"@type": "Answer", "text": "Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects."}}], "url": "https://capawesome.io/docs/sdks/capacitor/screen-orientation/"}
```
