An activity can use AsyncTask or Handler framework for background work. Both will continue to work even after user has moved away from the activity that started them and the onDestroy for the activity has been called. In other words, an activity is fully capable of doing background work even after its GUI has been shutdown.
In this scenario, use of Service for background work seems like redundancy. What does Service bring to the table that an activity can not do? Thanks.
What is a Service?
Most confusion about the Service class actually revolves around what it is not:
Thus a Service itself is actually very simple, providing two main features:
Read the rest of the documentation for more info
So one instance of a service would be something you want to happen at set intervals on its own without having to launch an activity or anything else to "launch" it. For example, SMSBackup is just a service that runs in the background, polling every X minutes your SMS messages and copies them into a gmail label, as a "backup" service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With