Search docs/
Getting StartedPlugins

Screen Orientation

Cordova plugin to set/lock the screen orientation in a common way.

Requires Cordova plugin: cordova-plugin-screen-orientation. For more info, please see the Screen Orientation plugin docs.

https://github.com/apache/cordova-plugin-screen-orientation

Premier Version Available

Featuring regular release cycles, security and bug fixes, and guaranteed SLAs.

Available here

インストール

ionic cordova plugin add cordova-plugin-screen-orientationnpm install @ionic-native/screen-orientationnpm install cordova-plugin-screen-orientationnpm install @ionic-native/screen-orientationionic cap sync
Ionic Native Enterprise はIonic Teamが完全にサポートしメンテナンスしているプラグインを利用できます。 詳しくみる か、エンタープライズプラグインに興味があれば 連絡ください

サポートしているプラットフォーム

  • Android
  • iOS
  • Windows

利用方法

Using React?

See here.

import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';

constructor(private screenOrientation: ScreenOrientation) { }

...


// get current
console.log(this.screenOrientation.type); // logs the current orientation, example: 'landscape'

// set to landscape
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);

// allow user rotate
this.screenOrientation.unlock();

// detect orientation changes
this.screenOrientation.onChange().subscribe(
   () => {
       console.log("Orientation Changed");
   }
);