java - The purpose of a service -


from understood, android service , nothing more wrapper around, respectively manager for, thread. 1 can't lengthy operations running in context of application's main thread (which happens manage ui calls well).

could shed light on purpose of service, if application class cover same functionality (https://stackoverflow.com/a/31490935)

an android service , nothing more wrapper around, respectively manager for, thread.

no. services not have separate thread default. services can create threads (and do), , specific service subclass create threads default (e.g., intentservice).

the application class cover same functionality

the application class not cover same functionality, more anonymouscoward class would. application instance not create thread, either. sort of thread manager (e.g., threadpoolexecutor) might used service not replace service.

quoting myself:

primarily, service exists flag operating system, indicating actively delivering value user, , therefore android should aim terminate other processes — not yours — when gets low on system ram. secondarily, service provides couple of apis ipc: “command” pattern (intent , startservice()) , “binding” pattern (bindservice()).

an application exists in app (an instance created when process started). not serve sort of flag os indicate process importance, nor have sort of ipc capability.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -