Can you explain why the Service put into a separate process (by adding the line android:process in the manifest)?


At first, I thought that in order to kill an application (brushing with a finger in the task manager), it would not die with activity. As practice has shown - he continues to live.
Then I thought that this was done so that when the service restarts itself, the activity does not open - and then again it’s not that! Restart activity does not open.
Then I thought that this was done in order not to slow down the activity! But here comes the IntentService ...

So what's the point?

    1 answer 1

    IntentService and Service different and used for different tasks.

    By default, the Service is valid in the UI stream, and the IntentService is in a separate one. Those. with a heavy load on the usual service will "slow down" the activation.

    It is not always possible and advisable to simply replace it with the IntentService , since It is used for other tasks (a one-time action - made and died) and, by default, should not be "long-lived", unlike Service (for example, a player with control from the notification).

    Thus, the Service taken out in a separate stream when it should be “long-lived” and, at the same time, should not “slow down” the activation.

    • However, this is not the answer to the question. - Vladyslav Matviienko
    • one
      @metalurgus, I answered to the best of my understanding and would love to read other answers to this question. - Yuriy SPb ♦
    • Your answer is good, I do not argue, but, unfortunately, it does not answer the question asked. So I would like to read in the usual language, why it may be necessary to make the service in a separate process . You explain on a large scale the difference between Service and IntentService , and reason on the topic of flows - Vladyslav Matviienko