Search code examples
pythonkivybuildozer

kivy on android, background service notification never disppears


As you know, for creating a background service for your kivy app, by adding a folder named 'service' to the root projects directory and writing your service inside that folder in a file named main.py and building the kivy app for android using buildozer, you can have a service running in the background on your application start-up. In you build() method you could do the following to start it.

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

But this creates a notification that shows up on app-start up and never disappears. A notification that opens the kivy app on selection and doesn't go away if you select it. Does anybody know how to get rid of it?


Solution

  • Actually if you use the second method 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.