Description
Checklist
- the issue is indeed a bug and not a support request
- issue doesn't already exist: https://github.com/kivy/python-for-android/issues
- I have a short, runnable example that reproduces the issue
- I reproduced the problem with the latest development version (
p4a.branch = develop
) - I used the grave accent (aka backticks) to format code or logs when appropriated
Versions
- Python: Any
- OS: Any
- Kivy: Any
- Cython: Any
- OpenJDK: Any
Description
python-for-android
made possible to set the activity android:screenOrientation
via --orientation
argument.
Unfortunately, when targeting API 31 and above, on Android 12 and above, this attribute is ignored, as the activity will run in multi-window mode.
From Android Docs:
android:screenOrientation
The orientation of the activity's display on the device. The system ignores this attribute if the activity is running in multi-window mode.
On Android 12, the multi-window mode is the standard behavior, and additionally:
On large screens (sw >= 600dp), the platform supports all apps in multi-window mode regardless of app configuration. If resizeableActivity="false", the app is put into compatibility mode when necessary to accommodate display dimensions.
On small screens (sw < 600dp), the system checks an activity’s minWidth and minHeight to determine whether the activity can run in multi-window mode. If resizeableActivity="false", the app is prevented from running in multi‑window mode regardless of minimum width and height.
So, resizeableActivity="false"
might be great to handle some specific configurations, but is not meant to be a solution for that.
Also, users may want to take advantage of such a feature. (Since the vastly majority of Apps now support multi-window mode)
But we still want to force a specific orientation, when the app is not in multi-window mode:
Setting KIVY_ORIENTATION
to a supported SDL configuration, (Portrait
, LandscapeRight
, ...) will force the App to keep the selected orientation, even if the device gets rotated.
So, as a quick workaround:
import os
os.environ["KIVY_ORIENTATION"] = "Portrait"
In a near future:
We should advise users that --orientation
has no effect anymore, and we should think about a (cross-platform?) migration plan.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status