Screen Orientation plugin


#1

this is the error i have: “device not supported”. The device that i am testing has android 5.0. I dont know what can be wrong.Please help


#2
  1. What plugin are you using? Link?
  2. Are you using it via Ionic Native? Link?
  3. Where exactly do you get that error?
  4. What is the exact, complete error?
  5. What is your ionic info output?

#3

1_ https://github.com/apache/cordova-plugin-screen-orientation
2_ Yes. https://ionicframework.com/docs/native/screen-orientation/
3_ I put this code in the constructor of app.component.ts:

if (this.platform.is('cordova')) {
      this.platform.ready().then(() => {
        this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
      })

    }

4_ Uncaught(in promise): NotSupportedError. screen.orientation.lock() is not available on this device.

5_global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.2.1

System:

Node       : v6.10.3
OS         : Windows 7
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

#4

Looks good.

What device are you testing on?
Does it work on other devices?


#5

I solve it after updating the plugin to 2.0.0 version.
Thanks for your help.