Closing Element closes background services
See original GitHub issueHello,
I’m using Android 10 with Element from F-Droid store. When I’m closing the app from “Recent apps” menu, this also stops any background activity, such as listening for events. This was not the case for Android 8 + RiotX. Also, for example, Telegram FOSS (which also has custom push notifications mechanism and not firebase) doesn’t cancel event listening in this case.
Also Element does not appear in Developer options -> Running services
unlike mentioned Telegram FOSS.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
When closing my app, it remains in background - Stack Overflow
1 Answer 1 · Either make the threads realize application is stopping (difficult but efficient approach) · Tell threads to terminate automatically ...
Read more >Element does not stay running in background #2143 - GitHub
I'll try to always close it from now on and see if I can discern a pattern. I was able to reproduce the...
Read more >Exit Chrome Completely by Closing Background Apps ...
Step 1: Go to Settings in Google Chrome. chrome settings ; Step 2: Scroll to the bottom of the screen and click Show...
Read more >Close programs running in the background in Windows
3. From the Windows Task Manager, open the Applications tab. From the Applications tab, highlight each application you want to close and then...
Read more >Error about closing apps or processes while installing
Error asking you to close an app or process. Some apps or processes run in the background even though you do not see...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My current understanding of this issue is that Element schedules synchronisation using a Worker or an Alarm, has a notification active while actually syncing, then schedules the next synchronisation. But if the system declines to run your worker, there’s no mechanism for restarting. I’ve had a play about with trying to add one (in #2921) but I’m not entirely clear that’s the direction to go in.
Also, we currently run the
SyncService
as a background service which runs a thread doing long-polling only while the application is in the foreground. From https://developer.android.com/guide/components/foreground-services?hl=en#start I think that it should be possible to run theSyncService
as a foreground service even when not actively running the application. This would result in a persistent notification (which can be hidden) and an ongoing sync. As we’re long-polling, this wouldn’t use (much) more battery than FCM, even, and should help avoid the delay of restarting synchronisation when returning to the app.Gotify Android (https://github.com/gotify/android), the self-hosted notification system, uses a websocket connection with its server + recommends disabling battery optimizations + utilizes a foreground notification for keepalive. In my experience, it uses minuscule battery over the day, doesn’t even show up on the battery stats page in Settings. However, I always receive every notification instantaneously.
Two takeaways: