just saw Google I/O 2010 – Android REST client applications where it was said:
start long running operations from a Service
And as I understand (My English is poor)
the main purpose of this is to prevent the app to be killed by the system. Right?
Is it good practice to perform all long running operation not only web ones from a Service?
As I understand if I create an object in activity and then the app process will be killed I will lose this object, but if I create this object in a service and after process will be killed – my object still will be alive. Right?
(SEPARATE THREAD) VS (SERVICE + SEPARATE THREAD)
What is different in the context of my question?
1. The Service API in Android is one of the key mechanisms for applications to do work in the background.
But it can easily implemented using a simple thread.
BUT:
*Once an application is no longer visible to the user it is generally considered expendable and a candidate to be killed by the system if it ever needs memory elsewhere. The main way applications get around this is by starting a Service component, which explicitly tells the system that they are doing some valuable work and would prefer that the system not kill their process if it doesn’t truly need to.*
So as I understand that is difference between a regular thread and a Service for our case.