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

kivy on android, background service notification never disppears

如您所知,要为您的 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')

但这会创建一个通知,该通知会在应用程序启动时显示并且永远不会消失。在 selection 上打开 kivy 应用程序的通知,如果你 select 它不会消失。有人知道如何摆脱它吗?

其实如果你用第二种方法here (of course with --bootstrap sdl2), such notification won't appear anoymore. Also something that was unclear for me a while was the path in --service which is meant as a path from your current directory to the python file when packaging.