kivy在android上,后台服务通知永远不会消失

时间:2017-03-17 02:46:33

标签: python kivy buildozer

如您所知,要为您的kivy应用创建后台服务,请添加名为' service'的文件夹。到根项目目录并在名为main.py的文件中将该服务写入该文件夹并使用buildozer为android构建kivy应用程序,您可以在应用程序启动时在后台运行服务。在build()方法中,您可以执行以下操作来启动它。

    def build(self):
        if platform == 'android':
            import android
            service = android.AndroidService('Notification Name', 'Notification Message')
            service.start('Service args')

但这会创建一个通知,显示应用启动并永不消失。在选择时打开kivy应用程序的通知,如果您选择它,则不会消失。有人知道如何摆脱它吗?

1 个答案:

答案 0 :(得分:0)

实际上,如果你使用第二种方法here(当然还有--service),这种通知似乎不会再出现了。我还有一段时间不清楚的是{{1}} which is meant as a path from your current directory to the python file when packaging中的路径。

相关问题