From a9925feed467eb289dee9489ed461d658e6a0d98 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 30 Jun 2021 11:09:44 +0800 Subject: [PATCH] bugfix --- kivyblocks/android_rotation.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kivyblocks/android_rotation.py diff --git a/kivyblocks/android_rotation.py b/kivyblocks/android_rotation.py new file mode 100644 index 0000000..27b8d36 --- /dev/null +++ b/kivyblocks/android_rotation.py @@ -0,0 +1,14 @@ +from kivy.utils import platform +try: + from plyer.platforms.android import activity +except: + activity = None + +def get_rotation(): + try: + r = activity.getWindowManager().getDefaultDisplay().getRotation() + print('get_rotation(): rotation=', r, type(r)) + return r + except Exception as e: + print('get_rotation() failed',e) + return None