Evening all,
does anyone know how to force a media device (android phone) to stay in portrait mode even if auto rotate is enabled in settings?
Force portrait mode
-
- Posts: 223
- Joined: Tue 17 Apr 2018, 21:03
Force portrait mode
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 458
- Joined: Tue 18 Jun 2024, 09:32
Re: Force portrait mode
Assuming you're using BBC2APK to build your app, I believe it tells you how to do that in the Help text.
However I haven't tried it in a long time, and since Android is always changing things my confidence that it will still work is limited!

-
- Posts: 223
- Joined: Tue 17 Apr 2018, 21:03
Re: Force portrait mode
Thanks Richard, I haven't tried to build the app yet, but I'll look through the help text to see
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 458
- Joined: Tue 18 Jun 2024, 09:32
Re: Force portrait mode
There's no way to force a particular orientation without building your own APK because that (and many other things, such as what permissions are requested) is a function of the app's manifest and that's something built into the APK.
You might be able to install an ON MOVE handler which emits some JNI code to flip the orientation back to what you want, but that would involve a disturbance to the screen because the orientation will change and then change back!
If the disturbance is acceptable, and you want to try that approach, there's a Stack Overflow article here. Calling the JNI from BBC BASIC code is not straightforward, but I have done it in the past.
On the general issue of forcing a particular orientation I asked DeepSeek and it said that Android is making this increasingly difficult, if not impossible, because it's contrary to the philosophy of Android apps being able to adapt to any screen size or shape.
Perhaps you should reconsider your approach in light of this.