【问题标题】:Is there any way for Kivy app to continue working in background?Kivy 应用程序有什么方法可以继续在后台工作吗?
【发布时间】:2020-11-29 09:11:29
【问题描述】:

我正在使用 kivy 制作一个 android 应用程序。我希望我的应用程序应该继续在后台运行,即使我按下 android 的最小化按钮。有什么办法吗??

【问题讨论】:

  • 您可以使用 Android 服务来执行此操作。
  • @inclement 你能告诉我如何使用android服务吗??

标签: python android python-3.x parallel-processing kivy


【解决方案1】:

如果您的意思是最小化应用程序,请将 on_pause 函数添加到您的 App 类:

class SomeApp(App):
    def build(self):
        return Label(text='hello')

    def on_pause(self):
        return True

    def on_resume(self):
        #do something after reopening app
        pass

但是,如果您的意思是创建后台进程或服务,即使您关闭应用程序也会继续运行,请尝试 this

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-02
    • 2019-12-26
    • 1970-01-01
    相关资源
    最近更新 更多