[Screen Orientation Plugin] Screen orientation plugin error: "the ScreenOrientation is not defined"

Forge Component
Published on 2016-11-08 by Experts
5 votes
Published on 2016-11-08 by Experts

Hi all,

The documentation on the forge says this plugin is not supported by OutSystems, so I generated an app to download on my iPhone but there's always the error message "the ScreenOrientation is not defined".

Does the not supported by OutSystems part mean this plugin can't be used at all in OutSystems, even if you generate and download a native app? Or does someone have an idea what the problem may be?

Thanks in advance,

Artuur De Maeyer

Hi Artuur,

Plugin is not supported by OutSystems, not means that you can't use with OutSystems shell but that there isn't an officical support. 

Regarding of your problem, the error you are getting means that the plugin was not installed on your app. 

Could you check if you have the dependency of the plugin defined in your app and generate again the App?



Hi Vitor,

Thank you for the fast reply. 

I see, so I can keep testing in OutSystems Now. 

I checked the dependencies of my app and the screen orientation plugin is there.

I've refreshed them and published my app again, but the same error pops up.

I've narrowed the problem down to the CheckPlugin JS in the PluginIsLoaded client action in the CheckScreenOrientationPlugin client action. The following always evaluates to true:

(typeof(screen) === "undefined") || (typeof(screen.lockOrientation) === "undefined")

Could this be the issue?

Hi Artuur,

This plugin isn't installed on OutSystems Now, with OutSystems Now you only can use these plugins.

To use Screen Orientation, you need to generate a new native application on Service Studio to install the Screen Orientation plugin on your app.



Hi Vitor,

Thanks for explaining the OutSystems Now plugins, I will only test the plugin in my native app. 

I've refreshed the dependencies again (the ones for the plugin are also there), republished my app, regenerated my QR-code, deleted the old native app and installed the new one. But I still get the same error unfortunately.

Any further thoughts?


Hi Artuut,

The same error is weird, that error means that plugin is not installed on your application.
Can you share the solution with me to take a look? 

Best regards,

Vitor Oliveira

Hi Vitor,

I looked at the url of the plugin (https://github.com/OutSystemsExperts/cordova-plugin-screen-orientation#1.4.2.os) and noticed these 2 things: 

"This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec." and

"For this plugin to follow the full API events should be fired on the screen object. iOS and BB10 do not currently support events on the screen object so custom event handling will need to be added (Suggestions welcome!)"

So I think a new version of the plugin is needed.


A colleague of mine showed me how to lock the screen orientation using the Extensibility Configurations:


It works, locking the screen orientation in portrait mode in my case. So it can easily be done without using the plugin.

Thanks for your help Vitor


Hi Artuur,

I'm glad that with Extensibility you can do what you need.

The Screen orientation is needed to lock or unlock the screen for specific use cases (some screens). I already could reproduce your issue and the workaround to that is open the plugin, refresh dependecies and publish again the plugin and the application.

Best Regards,

Vitor Oliveira