Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the screen orientation depending on the auto-rotate setting #1695

Open
bl1nch opened this issue Sep 12, 2023 · 7 comments
Open

Changing the screen orientation depending on the auto-rotate setting #1695

bl1nch opened this issue Sep 12, 2023 · 7 comments
Labels
needs-investigation More investigation needed target-android

Comments

@bl1nch
Copy link

bl1nch commented Sep 12, 2023

Description

Hello. At the moment, based on the documentation, Buildozer supports portrait and landscape orientations, but the application changes the screen orientation regardless of the state of the sensor on the user’s device. Thus, the orientation changes even if auto-rotation of the screen is disabled in the device settings. I've seen examples of fixing this using pyjnius but I would like to know if Buildozer supports this?

@RobertFlatt
Copy link
Contributor

Buildozer app rotation is enabled in buildozer.spec using orientation options.
https://github.com/Android-for-Python/Android-for-Python-Users#orientation

Android has a global 'auto-rotate' enable/disable option as part of Accessibility options.

Yes, I can confirm that Buildozer builds apps that ignore Android's global 'auto-rotate' disable.

In fact, I expect Buildozer apps ignore all the Android Accessibility options.

@misl6
Copy link
Member

misl6 commented Sep 16, 2023

Hi @bl1nch,

Can you please post your buildozer.spec file and confirm that the build has been performed with the latest version of buildozer from scratch?

@bl1nch
Copy link
Author

bl1nch commented Sep 20, 2023

Hi @misl6, sorry for such a late reply

buildozer-arm64-v8a.spec.txt

If it suddenly matters I have a custom build method with Github Actions, so I clone p4a and make some changes every time, so don't mind this line:

p4a.source_dir = .python/python-for-android

I constantly use the latest version of the builldozer

The solution with pyjnius that I found on the internet, but I’m not sure if it works since I haven’t had time to check it yet:

from jnius import autoclass
PythonActivity = autoclass("org.kivy.android.PythonActivity")
ActivityInfo = autoclass("android.content.pm.ActivityInfo")
activity = PythonActivity.mActivity
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER)

@bl1nch
Copy link
Author

bl1nch commented Oct 11, 2023

Hi @misl6, sorry for such a late reply

buildozer-arm64-v8a.spec.txt

If it suddenly matters I have a custom build method with Github Actions, so I clone p4a and make some changes every time, so don't mind this line:

p4a.source_dir = .python/python-for-android

I constantly use the latest version of the builldozer

The solution with pyjnius that I found on the internet, but I’m not sure if it works since I haven’t had time to check it yet:

from jnius import autoclass
PythonActivity = autoclass("org.kivy.android.PythonActivity")
ActivityInfo = autoclass("android.content.pm.ActivityInfo")
activity = PythonActivity.mActivity
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER)

I recently tested this solution and it works perfect

@misl6
Copy link
Member

misl6 commented Oct 12, 2023

have a custom build method with Github Actions

Which version of buildozer uses?

@bl1nch
Copy link
Author

bl1nch commented Oct 13, 2023

Last build with version 1.5.0
build

Copy link

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-investigation More investigation needed target-android
Projects
None yet
Development

No branches or pull requests

5 participants