diff --git a/kivy/__init__.py b/kivy/__init__.py index aa772ffcb..0b6bb8025 100644 --- a/kivy/__init__.py +++ b/kivy/__init__.py @@ -369,11 +369,11 @@ if not environ.get('KIVY_DOC_INCLUDE'): Logger.info('Core: Kivy configuration saved.') sys.exit(0) -# android hooks: force fullscreen and add android touch input provider -if platform() == 'android': - from kivy.config import Config - Config.set('graphics', 'fullscreen', 'auto') - Config.remove_section('input') - Config.add_section('input') - Config.set('input', 'androidtouch', 'android') + # android hooks: force fullscreen and add android touch input provider + if platform() == 'android': + from kivy.config import Config + Config.set('graphics', 'fullscreen', 'auto') + Config.remove_section('input') + Config.add_section('input') + Config.set('input', 'androidtouch', 'android') diff --git a/kivy/utils.py b/kivy/utils.py index 1130db85c..0b11531f4 100644 --- a/kivy/utils.py +++ b/kivy/utils.py @@ -12,6 +12,7 @@ __all__ = ('intersection', 'difference', 'strtotuple', 'interpolate', 'OrderedDict', 'QueryDict', 'platform', 'escape_markup', 'reify') +from os import environ from sys import platform as _sys_platform from re import match, split from UserDict import DictMixin @@ -332,11 +333,9 @@ def platform(): global _platform_ios, _platform_android if _platform_android is None: - try: - import android - _platform_android = True - except ImportError: - _platform_android = False + # ANDROID_ARGUMENT and ANDROID_PRIVATE are 2 environment variables from + # python-for-android project + _platform_android = 'ANDROID_ARGUMENT' in environ if _platform_ios is None: # TODO implement ios support here