I finished an Android program. It uses thread. No service.
I would like when the user closes the program with the BACK button
to give an option for the program to keep working in the back ground, or part of it.
The question is what is the best way to take and how to implement it.Is SERVICE the only
way to go or there is another way?
I have seen tracking programs do it.
Yes , service is the best choice of all to keep your application running in the background.
But also remember that keeping a service running does not mean its guaranteed to not getting killed.If resources are too low, Android system might kill your service too.
Please go through this and check Process lifecycle under it.
As you know ,phones are very limited in the amount of resources, its ideal that you do minimum amount of work in the background and also if you require to download something in the background after a specific time consider using AlarmManager instead of polling in the service.One purpose of creating a thread is not blocking the UI.Remember that a Service runs in the UI thread itself,So starting a thread inside a service is a better choice if you want to have long running background work.