Screen rotation help

I set ScreenOrientation 'portrait' in Designer Properties but when I open the app with holding phone horizontally, screen open landscape mode then rotate to portrait.

Open app screen with portrait mode without rotating animation.
Help plz...

If I set portrait in Designer Properties the phone opens in portrait whether it is held horizontally or vertical. It does not open in landscape and then rotate on my Samsung Android 8.1. I only tested using Companion. Does this happen only in the apk installed or in Companion too?

Could you provide an aia of an example demonstrating this behavior to test? What you see might be a feature of your Android version or your hardware manufacturer or a Setting on you device. You did not share that information.

1 Like

The same behavior is obtained with Android 12 (OnePlus Nord).

Thanks for helping me with this problem.... I attached test file below.
I tested 3 different android phones 'LG g8 android 11', 'Google nexus4 android 8.1', 'Xiaomi a1 android 9' and they got same output.

If needed I will upload screen open test video. thx

portraitTEST.aia (3.5 KB)

Could not replicate your problem, tested with Xiaomi MI A1 android 9. Screen doesn't rotate even when auto rotate is enabled from phone settings

1 Like

I could not replicate your problem either Bob.

portrait

You might try changing OpenScreenAnimation to Default. I get the same response regardless of setting this to Default or None . Your example sets this to None.

I suspect your issue might be related to this code in your example:

possibleIssues

1 Like

Ahh... you're right...
I use that LAYOUT block for latest projects so every latest projects have same problems...

My old projects didn't show rotation problem.
I should have checked that before...
I built problem by myself.

OpenScreenAnimation did nothing
Maybe LAYOUT procedure block brought rotating problem.
thx for helping me to start fixing it.

1 Like

@bob_kim please mark your solution if you have got it so that other developers having the same issue can be helped

Thank you

I'm still didn't get the solution. unfortunately...
For solving this step by step, I just made new project with only one text in portrait screen mode.
and test it then BOOM!! It also rotate screen.

I guess this problem maybe linked to newest version of app inventor since my old projects run portrait without rotate.

Sorry for bring it up again...

I upload aia file and test video
portraitTEST2.aia (1.1 KB)

(At video, run portraitTEST2 / above one is Nexus 5x android 8.1 and below one is Xaiomi a1 android 9)

Nothing to be sorry about Bob. I compiled your portraitTEST2.aia on my Samsung Android 8.1 TabA. I do not see the screen rotating from Landscape to Portrait.

You are experiencing an issue I do not. When you build and test do you use a Companion 2.62?
I can not explain the difference in behavior any other way. You might be using an older Companion. Both dora and I do not see what you show in the video using the latest release. Note dora also has an xiaomi Android 9 as you do but I do have an Android 8.1.

Perhaps someone else will join the conversation and have some other possible ideas to explain the behavior difference.

1 Like

I compiled your aia as apk, install it on Xiaomi MI A1 android 9, could not replicate error. Works as intended

1 Like

Is your table tilted?

I was unable to reproduce the problem.

Maybe you are running an old .apk from before you fixed Screen1 at Portrait?

3 Likes

Yes, I used a Companion 2.62
I reinstall a Companion and the app just in case it solve the problem but rotation happens again.

so I did another test.
Install a new copied project of my old app which didn't rotate then compare the old one and the copied new one. (Old app installed at Nov 15, 2021)

Here's result video.
testing at LG g8 android 11
above one in a screen is the copied app below one is the Old app.
Same app but other result.

Attached two old and copied apps, they are twins.
LaterV2.aia (47.8 KB)
LaterV2_test.aia (47.9 KB)

Try this:
LaterV3.aia (47.8 KB)

1 Like

see post " screen orientation " on december 21

1 Like

try to put a link for that

2 Likes

I tried this but still rotates screen.

I did another test with other app I installed in my phone years before.
ScreenOrientation of the app was set to Unspecified, and didn't rotate when start.
Just Build apk, read QR code then update the app. And did rotate when start.
So I set ScreenOrientation to Portrait then Build and update the app... and rotate...

even MiT AI2 Companion app I had in my 3 phones rotate it's screen when start.

I have now tested my aia (APK) on several devices (Android 9, 10, 11, 12). It works fine on Android 10-12, but it's actually still rotating on one of my old Android 9 devices. So I adjusted my aia a bit and now it works on Android 9 as well.
LaterV4.aia (47.8 KB)

2 Likes

LaterV4 is rotating on my Android 9, 10, 11 devices.
LaterV3 is rotating on my Android 9, 10, 11 devices.

I attached video about LaterV4, LaterV3, Companion are rotating on Android 9.
MIT AI2 Companion version 2.62

I don't get why couldn't replicate rotation problem except mine. :frowning: