634
Views
12
Comments
[Screen Orientation Plugin] How to set the orientation for a screen?
Question
Forge component by Experts
5
Published on 18 Jun 2020

Hi,

I'm trying to open a screen in landscape mode. I've called the "LockOrientation" action with parameter set to "landscape" in the OnInitialize, but this doesn't work. Also in the OnReady no effect. I've put the call just before navigating to the screen, but this doesn't work either.

My question is : Where should I put the call to set a screen to landscape?

Thanks in advance,

Menno

mvp_badge
MVP
Rank: #63

Hi Menno,

You can put it in the OnInitialize or the OnReady (or on the OnRender but not a good idea). I was able to make it work in an Android device.

Are you getting any error in the output parameter of the LockOrientation?

Cheers,

José

Rank: #1906

Hi José,

No errors or something like that. The orientation remains the same. Just nothing happens.

I've implemented the orientation event widget you've created to react on that and change objects accoordingly. That is actually better, because now the users aren't forced to turn their devices to see it correctly.

Thanks,

Menno

mvp_badge
MVP
Rank: #63

Hi Menno,

Just for reference, what Android version are you using? Thanks.

Cheers,

José

Rank: #1906

Hi José.

I've tested it on a Samsung S4 with Android 5.0.1

Cheers,

Menno


Rank: #34090

Menno Hoogsteen wrote:

Hi José.

I've tested it on a Samsung S4 with Android 5.0.1

Cheers,

Menno



Hi Menno,

I'm having the same problem. Have you managed to solve it?

Thanks,

Ray



Rank: #1906

Hi Ray,

I didn't solve it, but implemented functionality to detect the change in orientation to display different information.

See this thread:
https://www.outsystems.com/forums/discussion/32749/event-to-detect-device-rotation-orientation-mobile-app/

Menno

I am having the same issue, I put the code in the OnInitialize and is not working, i put the orientation "portrait" and is not working, i am getting the error "the ScreenOrientation is not defined"

Thanks in advance

Kind Regards


Rank: #3290

good morning, if the auto rotate is disable, how can we detect the orientation ?

Rank: #8303

I am making an app that has videos you can play. Can I use this plugin to change the orientation of the screen only when the video is playing and not on any other screen?     

Champion
Rank: #364

Yes you can, I've done it recently on a mobile app.

So when video is played in full screen it will go to landscape, and if user exits full screen it will go portrait mode again.

Rank: #8303

Thanks for your reply Pedro. 

I tried and it is working. A weird behavior I noticed during testing was, when the user starts the app, it goes to landscape mode for a second and then comes back to portrait. Any idea what might be causing it and how to rectify it?

Champion
Rank: #364

I can't tell exactly why that's happening without looking at it , but you can set the Extensibility Configurations on the mobile module, in order to lock in portrait mode. That way the app will always be in portrait by default.

{

    "preferences": {

        "global": [

            {

                "name": "orientation",

                "value": "portrait"

            }
]
}
}