I make an application that will be from the GUI and which should also constantly work in the background even if the GUI itself is closed / destroyed / destroyed. It should start automatically when the phone boots.
In the background, it will send data to the server, say, every 10 seconds.
Googling, I concluded that one of the ways to do this is Service. And the second is the ScheduledThreadPoolExecutor. The rest are not suitable (alarm manager, timer, handler).
What do you advise? Which of these methods to choose? Which is better for my task?