I am seeing my app in the following screen

https://i.stack.imgur.com/BbqqZ.jpg

If I swipe my app to the right, I notice that the process and services related to app are killed.

  1. How to avoid killing the process and services when we swipe?
  2. How to keep the service (I am using IntentService - so other
    answer mentioned for similar question doesn't work) running when the app is swiped to right?
  3. Answer mentioned here restarts (which means the service doesn't do its job for few seconds during the restart phase) the service and process. I want the service to work continuously without any drop. How to do this?
1

There are 1 answers

4
Tharaka Devinda On

For this you need to start your service as a foreground service. Refer here under Running a service in the foreground.

If you start the service which is a background service, Android will kill it whenever memory is low. And take note, not every time that list is cleared, your service will die. It happens only when the Android system decides its low on memory.