Skip to content

"--orientation sensor" no longer works #1688

Closed
kivy/kivy
#6138
@RobertFlatt

Description

@RobertFlatt

Versions

  • Python: 3.6
  • OS: Ububtu 18.04
  • Kivy: default
  • Cython: 29.1

Description

using p4a (master) installed 2/6/2019 (same with installed 2/2/2019)
this uses SDL 2.0.9

App is stuck in portrait mode regardless of p4a --orientation
Example uses --orientation sensor

Cause seems to be "LandscapeLeft LandscapeRight" (see log file below)
I thought these were iOS things, so perhaps some code overflow?

main.py:

from kivy.app import App
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle
from kivy.core.window import Window

class Demo(App):
    def set_background_color(self):
        with self.label.canvas.before:
            Color(0.5, 0.0, 0.5)
            Rectangle(size=Window.size) 
       
    def _resize_handler(self,obj,size):
        self.set_background_color()

    def build(self):
        Window.bind(size=self._resize_handler)
        self.label = Label(text = 'Greetings Earthlings')
        self.set_background_color()
        return self.label

if __name__ == '__main__':
    Demo().run()

buildozer.spec

Command:

p4a apk

Spec file:
.p4a

--dist_name=ex
--private .
--package=com.example.ex
--name Ex
--requirements=python3,kivy
--arch=armeabi-v7a
--orientation sensor
--sdk_dir /home/bobf/androidtools/sdk
--ndk_dir /home/bobf/androidtools/android-ndk-r17c
--android_api 28
--ndk-api 21
--version 0.0.0

Logs

logcat:

02-06 14:56:09.498 31440 31468 I python  : [WARNING] Could not satisfy Android orientation "LandscapeLeft LandscapeRight", only {portrait,landscape} are currently supported. Defaulting to portrait
02-06 14:56:09.502 31440 31468 E libEGL  : validate_display:92 error 3008 (EGL_BAD_DISPLAY)
02-06 14:56:09.502 31440 31468 V SDL     : setOrientation() orientation=1 width=1080 height=2160 resizable=true hint=Portrait
02-06 14:56:09.560 31440 31440 V SDL     : surfaceChanged()
02-06 14:56:09.560 31440 31440 V SDL     : pixel format RGB_565
02-06 14:56:09.560 31440 31440 V SDL     : Window size: 1080x2160
02-06 14:56:09.560 31440 31440 V SDL     : Device size: 1080x2160

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions