1

If I remove the app from the background/recent app list, the UI thread also stops so that system can reclaim the memory associated with the UI. Now consider a case where a PeriodicWorkRequest is triggered which in turn starts a worker (after the app is removed from the background/recent apps list). The worker implicitly runs on a separate background thread and is performing the assigned tasks. But is the UI/Main thread also created along with the worker thread?

An app can exist with no activity. It can have other components like services etc with no UI. In this case, does the UI/Main thread still exist?

Or in any other scenario, can a process exist with no UI/Main thread, just a worker thread?

Parth Kapoor
  • 1,494
  • 12
  • 23
  • Main thread & looper will always be initialized alongside application regardless of how it was started. – Pawel Feb 15 '21 at 13:36

1 Answers1

0

In android things get complicated really fast. Android is a fragmented ecosystem and some OEM perform some device alterations that result in different behaviors across devices for example when you close an app instead of doing a grace shutdown it does a kill to provide an immediate effect. even background workers are not very guaranteed, read some more here

Background workers are you best bet.

kenn
  • 1,384
  • 12
  • 19