I am trying to build android app using kivy. How I can hide my app but still keep it running in the background like a deamon?
from kivy.config import Config
As Inclement already mentioned, you need to start an android service for this. This kivy planet post (which appeared after you asked the question) gives a walk through of how to have a program, a service, and have them interact with each other.
You need to use an android service if you want to actually do computation in the background. Python-for-android can do this, the relevant documentation is here (old_toolchain). For the new toolchain method see here.
If you just want your app to not be closed completely (so that it doesn't restart entirely with the splash screen etc. every time), you just have to add an on_pause
method to your App class, and it should return True
. You can also do any pre-pause stuff in this method. However, the app doesn't really keep running, it just keeps memory state.
In the latter case, be aware that android can and sometimes will kill apps in a pause state. This is a normal part of the way apps are handled and you can't avoid it, so you should save any important state in your on_pause
method.