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

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

  
Forge Component
(2)
Published on 2016-11-08 by OutSystems Experts
2 votes
Published on 2016-11-08 by OutSystems 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?


Regards,

Vitor

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.


Thanks,

Vitor


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?

Artuur

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.

Solution

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

https://success.outsystems.com/Documentation/10/Delivering_Mobile_Apps/Customize_Your_Mobile_App/Set_the_Preferences_for_Your_Mobile_App

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

Solution

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