kivyblocks/kivyblocks/serviceControl.py
2019-12-23 19:34:40 +08:00

13 lines
392 B
Python

from jnius import autoclass
def startService(className):
# service = autoclass('your.service.name.ClassName')
service = autoclass(className)
mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
service.start(mActivity)
def stopService(className):
service = autoclass(className)
mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
service.stop(mActivity)