You control portrait and landscape in NativeScript by matching the platform's orientation model: iOS apps declare supported orientations in the app manifest and change them at runtime through the app delegate, while Android apps read and write the activity's screenOrientation attribute. NativeScript exposes both through its application module and per-page properties, so the practical answer is to set a default at the app level, override it per page or per screen when a specific layout demands it, and subscribe to orientation change events if your UI needs to reflow.
The key condition is that iOS and Android treat orientation restrictions differently. A runtime call that works on one can silently do nothing on the other, so any robust implementation needs a small platform branch and a way to verify the result on a real device rather than a simulator alone.
Setting the App-Wide Default Before You Write Any Screen Code
Orientation control in NativeScript has two layers, and confusing them is the most common source of bugs. The first layer is what the operating system allows the app to do at all. The second is what the app requests at any given moment. If the first layer forbids landscape, no runtime request will produce landscape on iOS.
On iOS, the allowed set lives in the app's Info.plist, under the UIFileSharingEnabled neighbor keys UISupportedInterfaceOrientations (for iPhone) and UISupportedInterfaceOrientations~ipad. A NativeScript project commonly exposes these through App_Resources/iOS/Info.plist. If your app must ever rotate to landscape, both portrait and landscape entries must be present in that array, because iOS intersects your runtime request with the declared set. Declaring only UIInterfaceOrientationPortrait and then asking for landscape at runtime yields portrait, with no error.
On Android, the equivalent control is the android:screenOrientation attribute on the activity in AndroidManifest.xml, typically inside App_Resources/Android/src/main/AndroidManifest.xml. Valid values include portrait, landscape, sensor, unspecified, and fullSensor. The sensor value follows the device's physical rotation but ignores a user's system-level rotation lock; user respects the system lock. That distinction matters more than most tutorials admit, because a user who has locked rotation system-wide will see your "sensor" app stay put.
A sensible default is to allow both orientations in the manifest and then constrain behavior per screen, rather than hard-locking the whole app. That keeps the manifest honest and leaves runtime control as the single source of truth for layout decisions.
The Runtime API: Orientation Module and Screen Orientation Helpers
NativeScript's core @nativescript/core package ships an Application class with orientation-related facilities, and older tutorials reference a dedicated screen-orientation module from nativescript-screen-orientation. The stable, framework-level pieces you can rely on are:
Application.orientation() returns the current orientation as a string such as "portrait", "landscape", "portraitUpsideDown", or "landscapeLeft"/"landscapeRight" depending on platform. Application.on(Application.orientationChangedEvent, handler) fires when the device orientation changes while your app is in the foreground. Page objects expose a requestedOrientation property that constrains that page.
The older nativescript-screen-orientation plugin exposed screenOrientation.setOrientation("landscape") and screenOrientation.lockOrientation(...), and it is still referenced in many existing codebases. If you're starting fresh, prefer the per-page requestedOrientation property plus a thin platform helper, because it avoids a plugin dependency and keeps the logic visible in your own code. Either way, the plugin and the core API both ultimately call the same native mechanisms described below.
Using the Page requestedOrientation Property
The cleanest cross-platform lever is requestedOrientation on a Page. Set it in the page's loaded or navigatingTo handler:
The Orientation enum provides portrait, landscape, portraitUpsideDown, and unknown. Because this is a page-level property, it applies while that page is on screen and lets the next page request something different, which is exactly what you want for a video player that should be landscape sitting inside an otherwise portrait app.
Two cautions. First, iOS honors this only within the manifest's allowed set, so if you constrain Info.plist to portrait-only, the property has no visible effect there. Second, orientation changes trigger a re-layout, so if you capture element measurements in loaded, recalculate them after the rotation event rather than caching stale dimensions.
Handling the orientationChanged Event Correctly
The event handler is where most real-world complexity lives. A minimal, safe handler looks like this:
The handler receives an OrientationChangedEventData whose newValue carries the current orientation, so you can also read args.newValue. Two behavioral details worth knowing: the event fires on device rotation and on programmatic orientation requests on Android, but on iOS programmatic requests are constrained by the manifest as already described. Also, firing order relative to your page's layout pass isn't guaranteed across versions, so if you must measure after rotation, wrap the measurement in a short setTimeout or a layout-change subscription rather than assuming the view tree is already final.
Keep the handler cheap. Rebuilding a whole view hierarchy inside the rotation callback produces visible jank, especially on lower-end Android devices. Prefer toggling CSS classes or observable flags that bind to layout, and let the framework do the reflow.
Platform-Specific Control When Cross-Platform Handling Falls Short
When the page property isn't granular enough, drop into native calls with a platform branch. On Android, you can set the activity's requested orientation:
On iOS, the canonical approach is to override application:supportedInterfaceOrientationsForWindow: in the app delegate, or, with the modern scene-based lifecycle, in your scene delegate or via the UISupportedInterfaceOrientations intersection. NativeScript's runtime wires through an app delegate you can extend with a native class, but the simplest reliable path is the manifest plus requestedOrientation, because it avoids fragile delegate surgery that breaks across NativeScript major versions.
If you do need iOS runtime control, the pattern is to store a flag (for example, a static property on a helper) and return the allowed mask from the delegate method based on that flag, then rotate manually by setting UIDevice.current.setValueForKey—but note that UIDevice.setValue was deprecated in iOS 16, so on current iOS versions the supported route is UIWindowScene.requestGeometryUpdate with a UIWindowSceneGeometryPreferencesIOS. That call requires the scene's supportedInterfaceOrientations to already permit the target orientation. This is the specific place where "control" becomes a two-step dance on iOS: declare, then request.
Because the iOS mechanism changed across iOS 16+, verify which iOS version your build targets before adopting any delegate-based snippet from a tutorial. Code written for iOS 15 and earlier may compile yet fail to rotate on a modern device.
Verifying Success and Recognizing Failure
A reliable check is to log three values together: the manifest's allowed set, Application.orientation() at the moment of the request, and the on-screen layout state. If the request "succeeds" but the screen doesn't move, the manifest is usually the culprit on iOS; on Android, the activity's screenOrientation attribute plus the user's system rotation lock are the usual suspects.
Test on a physical device with the system rotation lock both on and off. Many orientation bugs only appear when the OS lock interacts with your request, and simulators frequently behave differently from real hardware on Android's sensor mode.
A second verification: navigate away from a landscape-locked page and confirm the next page returns to your intended default. Forgetting to reset requestedOrientation on page exit is the classic cause of an app stuck in landscape after leaving a video screen.
Edge Cases That Break Naive Implementations
iPad multitasking is the biggest one. On iPadOS, an app that supports multiple window sizes can be resized to a landscape-shaped window while the device itself is portrait, so Application.orientation() may report one thing while the visible aspect ratio suggests another. If your layout depends on available width rather than device orientation, subscribe to the root view's layoutChanged event and branch on width > height instead. That approach also survives split-screen and resizable windows on Android tablets and foldables.
Background and foreground transitions are the second edge case. An orientation change that happens while your app is backgrounded may not fire the event when you return, so re-read Application.orientation() in your resume or applicationResumeEvent handler and sync your layout state there.
Finally, keep in mind that orientation is a UI concern, not a data concern. Persisting a "last orientation" preference across sessions usually creates more surprise than it prevents, and it conflicts with the user's system-level rotation lock expectations on Android.
To recap the workable order of operations: declare the full supported set in both manifests, set a modest app-wide default, override per page with requestedOrientation, use a platform branch only for the gaps, listen to orientationChanged for layout updates, and validate on hardware with rotation locks in both states. That sequence produces predictable behavior on both platforms without fighting either one's orientation model.