Intent services are nothing more than workflows that are initiated by intent, execute their actions in a separate thread, and then close. They are designed to start and stop.
If you need to do things like http get, or in any case an interaction that does not require a server connection, use the intent services and notify your actions with broadcast events.
If your application should remain connected to the server (i.e., by permanently connecting to tcp), then what should I go for is to have a service (and not intentional) that performs network interaction using an asynthetic or more classical stream, hosted by the service. You can then activate the action using the bindToService () service.
I would recommend not using asynctasks inside the action. You risk losing the serverโs response in case of changes in the horizontal / vertical view, as indicated in its answer1.
source share