Even activity can be performed in the background, you just need to make sure that you DO NOT unregister the event listener with onPause ().
A service is nothing more than activity without a user interface. Thus, in this case it may be “better” to create a service, but it is certainly not necessary if you feel the overhead of adding a service, and the connections connected with it are not worth it, especially on air if you do too much may cost you in terms of performance and energy consumption.
source
share