I wrote an application using Python which receives data via Bluetooth, I need it to work even if it is closed. I can manage on_pause
and on_stop
functions by returning True
or False
. But when I added on_pause
, on_resume
and on_stop
functions to my code, app does not continue receiving data (in the background and when it is closed), and restarts (on_resume
). I need the application to work on_pause
(in the background) and on_stop
(when it is closed) and even when the user restarted his/her phone (and did not open it). And I read I should use Services to run my app when it is not opened. I use buildozer
to debug my code, it is unclear to me, what I should add to my Python code and buildozer
.
Any help is greatly appreciated.
Asked
Active
Viewed 66 times
0

CreepyRaccoon
- 826
- 1
- 9
- 19

tahami
- 38
- 9
-
Does this answer your question? [How to keep kivy service running in background in Android (service still run when switch to other App or lock the screen)?](https://stackoverflow.com/questions/63218114/how-to-keep-kivy-service-running-in-background-in-android-service-still-run-whe) – Amin Etesamian Jan 08 '23 at 15:44
-
Not exactly! I need the application work even it is closed! not just in background! – tahami Jan 10 '23 at 10:50
-
I do not know how to use `service` in my code. What I should write for `package_name` and `service_name`. `service = autoclass('{}.Service{}'.format(package_name, self.service_name)) mActivity = autoclass('org.kivy.android.PythonActivity').mActivity argument = '' service.start(mActivity, argument)` – tahami Jan 15 '23 at 12:27
-
even [this answer](https://stackoverflow.com/questions/71367375/how-to-run-my-kivy-app-in-the-background-with-a-service-file) did not help me. Maybe, because I am new in Kivy-android programming. – tahami Jan 15 '23 at 12:34