1

please its a request to dont mark my question as irrelevent ,duplicate,etc

i want to clear the point

in one of stackoverflow answer--> https://stackoverflow.com/a/57018094/12553303

this user saying that

The job given to the IntentService would get lost when the application is killed

and in one of the site --> https://guides.codepath.com/android/starting-background-services

this blog says -->

The IntentService class used to be the way for running an operation on a single background thread. IntentService runs outside the application in a background process, so the process would run even if your application is closed.

Thanks need clarification

IRON MAN
  • 191
  • 3
  • 18
  • "please its a request to dont mark my question as irrelevent ,duplicate,etc" -- however, it *is* unclear. What is your question? Note that `IntentService` has been deprecated for a few years. – CommonsWare Sep 28 '20 at 11:20
  • @CommonsWare that user is saying tasks of intentservice gets lost when application close is it right? – IRON MAN Sep 28 '20 at 11:23
  • 1
    "Closed" does not really have a clear definition in Android app development. However, there definitely are scenarios where an `IntentService` will "lose" jobs, such as when the user presses "Force Stop" on the app's screen in Settings. Note that the particular Codepath tutorial that you are linking to seems to be several years old and is out of date. – CommonsWare Sep 28 '20 at 11:42

1 Answers1

1

Since Android 8.0 IntentService changed so the System can kill your background process when it consider necessary and now, since API 30 it is deprecated.

If you want something that survive when app get closed, consider using WorkManager or JobIntentService.

Bogdan Android
  • 1,345
  • 2
  • 10
  • 21
  • so you are saying this statement --> `The job given to the IntentService would get lost when the application is killed` its right? – IRON MAN Sep 28 '20 at 11:26
  • Yes, if the system need resources will kill your job. You shouldn't use this class anymore. Instead, use workManager that is the actual class that we have to use now. – Bogdan Android Sep 28 '20 at 11:28
  • Btw @IRONMAN if the answer solved your questions consider selecting it as the accepted answer. – Bogdan Android Sep 28 '20 at 11:46