changeset 141:8a0019ce3632

core (android): service is now launched using pyjnius, as recommended in doc
author Goffi <goffi@goffi.org>
date Fri, 13 Apr 2018 18:58:14 +0200
parents 8f33a7c09214
children d276cfec38e8
files cagou/core/cagou_main.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Fri Apr 13 18:58:11 2018 +0200
+++ b/cagou/core/cagou_main.py	Fri Apr 13 18:58:14 2018 +0200
@@ -72,7 +72,6 @@
 
 if kivy_utils.platform == "android":
     # FIXME: move to separate android module
-    kivy.support.install_android()
     # sys.platform is "linux" on android by default
     # so we change it to allow backend to detect android
     sys.platform = "android"
@@ -282,9 +281,11 @@
             from sat.core import sat_main
             self.sat = sat_main.SAT()
         if sys.platform == 'android':
-            from android import AndroidService
-            service = AndroidService(u'Cagou (SàT)'.encode('utf-8'), u'Salut à Toi backend'.encode('utf-8'))
-            service.start(u'service started')
+            from jnius import autoclass
+            service = autoclass('org.goffi.cagou.cagou.ServiceBackend')
+            mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
+            argument = ''
+            service.start(mActivity, argument)
             self.service = service
 
         bridge_module = dynamic_import.bridge(bridge_name, 'sat_frontends.bridge')