When we start the service, you can exit the application, but it will continue to run. But if you delete an application from the tabs, it will close, not just collapse ...

But there is in fact, let's say, a Broadcast receiver, which can be put on listening to the launch of the device, and as soon as the device is launched, then something happens ... After all, the application does not open even in tabs ...

So, probably, somehow you can start the service so that it just worked?

I have a situation with data transfer to the server, depending on the quality of the Internet, this may take some time ... I think, while the service will run data transfer, the user will remove the application from the tabs and the process will stop ...

  • one
    Try to launch a notification from the service, in which you can show the startForeground() loading process (it seems to be written like this). In this form, it seems, the service will not be nailed when the application is brushed by the user. - Yuriy SPb
  • You have an erroneous understanding of BroadcastReceiver, it does not hang in processes, it is registered in the system and it works every time a certain process occurs, something like CallBack, only at the device level. His onRecive method works and is immediately killed, and his life is very short, in a region of 10 seconds. after that, the system drops it regardless of the actions. the Service component has a completely different life - it’s also stormy, but not so impulsive)) Above, here is a great comment, you saw Notif when there is an application update, try to brush it off. - Shwarz Andrei
  • @ShwarzAndrei I understand how the BroadcastReceiver works, but my question was how to make the process not kill when the user looks like an application ... Based on your answer, I did not fully understand whether the device will kill the service if you flick the application or not? - Aleksey Timoshchenko
  • you won't be able to brush it up every now and again ru.stackoverflow.com/a/545233/191270 - Shwarz Andrei

0