1004
Views
12
Comments
[Screen Orientation Plugin] How to set the orientation for a screen?
Question
screen-orientation-plugin
Mobile icon
Forge asset by Experts

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

2020-03-05 14-29-02
José Costa

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é

2021-09-10 20-38-28
Menno Hoogsteen

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

2020-03-05 14-29-02
José Costa

Hi Menno,

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

Cheers,

José

2021-09-10 20-38-28
Menno Hoogsteen

Hi José.

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

Cheers,

Menno


UserImage.jpg
ray huang

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



2021-09-10 20-38-28
Menno Hoogsteen

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

2022-09-01 23-57-30
Everton Motonio Lima

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


UserImage.jpg
Diogo Teixeira

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

UserImage.jpg
Manmohan Sah

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?     

2019-12-01 23-50-25
Pedro Neto
Champion

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.

UserImage.jpg
Manmohan Sah

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?

2019-12-01 23-50-25
Pedro Neto
Champion

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"

            }
]
}
}

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.