Kivy APP not working in background when application is switched(Android)

45 views
Skip to first unread message

My Review

unread,
Sep 29, 2020, 7:28:32 AM9/29/20
to Kivy users support
I have written a basic kivy code where my app visits a website every minute and display the necessary fetched data. It works fine in my pc but when I deployed it on android app stops working when it is in background. Therefore notifications are not displayed by my app. here is the log which appeared when I pressed home button.
09-28 19:45:40.954  27008   27008   org.app.stockapp    V   PythonActivity  onPause()
09-28 19:45:40.954  27008   27008   org.app.stockapp    V   SDL onPause()
09-28 19:45:40.954  27008   27008   org.app.stockapp    V   SDL nativePause()
09-28 19:45:40.997  27008   27008   org.app.stockapp    V   SDL surfaceDestroyed()
09-28 19:45:41.055  27008   27008   org.app.stockapp    V   SDL onWindowFocusChanged(): false

and here is the log obtained after re-opening the app.

09-28 19:52:55.784  27008   27008   org.app.stockapp    V   PythonActivity  onResume()
09-28 19:52:55.784  27008   27008   org.app.stockapp    V   SDL onResume()
09-28 19:52:55.823  27008   27008   org.app.stockapp    V   SDL surfaceCreated()
09-28 19:52:55.823  27008   27008   org.app.stockapp    V   SDL surfaceChanged()
09-28 19:52:55.823  27008   27008   org.app.stockapp    V   SDL pixel format RGB_565
09-28 19:52:55.823  27008   27008   org.app.stockapp    V   SDL Window size: 1080x2094
09-28 19:52:55.824  27008   27008   org.app.stockapp    V   SDL Device size: 1080x2160
09-28 19:52:55.844  27008   27008   org.app.stockapp    V   SDL onWindowFocusChanged(): true
09-28 19:52:55.844  27008   27008   org.app.stockapp    V   SDL nativeResume()

Is there any way by which I can allow my app to run in background and send notification while running in background. Don't worry about android killing app.

I found some solutions but none of them worked.


I found that we can create ./services/main.py file but don't know what to write to enable app run in background.

Robert Flatt

unread,
Sep 29, 2020, 12:40:38 PM9/29/20
to Kivy users support
This is the expected behavior, unlike your desktop Android is not multitasking.
As you point out the way to go is a service.

My Review

unread,
Sep 29, 2020, 9:05:15 PM9/29/20
to kivy-...@googlegroups.com
But, I have no idea on writing services can you help?

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6e263077-b0a9-4240-99e5-e8432540a9afo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages