Commit 604b4e5b authored by Philipp Auersperg's avatar Philipp Auersperg

service basics

parent cb7666b0
......@@ -10,7 +10,7 @@ Minimal Kivy Service example with a simple echo service
starting app via logcat works now
$ am start org.bd.servicetest/org.kivy.android.PythonActivity
$ adb shell am start org.bd.servicetest/org.kivy.android.PythonActivity
or start the service (unfrtunately with error):
......
......@@ -3,6 +3,7 @@ from kivy import platform
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.properties import BooleanProperty
import logging
from kivy.logger import Logger
......@@ -17,8 +18,10 @@ def start_service():
argument = ''
res=service.start(mActivity, argument)
print('service started:', res)
return True
else:
Logger.error("wrong platform:"+platform)
return False
def start_service_locally():
import serv
......@@ -26,16 +29,18 @@ def start_service_locally():
Builder.load_string("""
<MainWindow>:
Button:
text:'push me'
on_release: root.test()
Button:
text:'start service'
on_release: root.start_service()
orientation:'vertical'
# Button:
# text:'start service'
# on_release: root.start_service()
Label:
text: 'service started and listening on port 8077' if root.service_started else 'service not started'
""")
class MainWindow(BoxLayout):
""""""
service_started = BooleanProperty(False)
def __init__(self, **kw):
super().__init__(**kw)
Clock.schedule_once(self.start_service)
......@@ -45,7 +50,7 @@ class MainWindow(BoxLayout):
def start_service(self, *a):
print("starting service...")
start_service()
self.service_started = start_service()
class ServiceApp(App):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment