How to keep kivy service running in background in Android (service still run when switch to other App or lock the screen)?

后端 未结 2 1079
一个人的身影
一个人的身影 2021-01-24 04:38

I\'m trying to build an android APP with kivy,my requirement is quit simple:

When open the android APP,it will start counting from 0, and a prompt will pop up in the stat

2条回答
  •  时光取名叫无心
    2021-01-24 05:00

    is this code

    from jnius import autoclass
    service = autoclass(SERVICE_NAME)
    mActivity = autoclass(u'org.kivy.android.PythonActivity').mActivity
    argument = ''
    service.start(mActivity, argument)
    

    inside the service.py or main.py

提交回复
热议问题