For the background task execution in the Android environment, 4 classes are available: HandlerThread , Thread , IntentService , AsyncTask . Using which class is effective for performing background tasks if tasks arise non-permanently?
The main task is to obtain information from the Internet. Due to the impermanence of the tasks, it is unclear what class to use for achieving the best efficiency.
HandlerThread is good for performing frequent requests, but for rare ones, a simple thread. Thread is good with rare requests, but with frequent - a drop in performance (object creation + reservation of necessary resources). AsyncTask similar to Thread. IntentService is good for all tasks, but performance problems may be due to the frequent launch of the service by the android system.
Who can that advise?