I have implemented a background service that read and writes different data from my app to my background server to a database.
On my first version I used two services for this. One created an entry in an queue, to know what task should be done next. The other service performed the task. A task was: Calling a PHP Script to read or write data with json.
So on a refactoring process, I did this differently. I had now one Service, which runs every 3 seconds and makes a thread which perfoms the task. The code for performing the data transfer did not change.
But now, the code runs soo slow and I also have memory leaks. So my question is: Is a service handled different as a thread in android? So does the service get more cpu or more memory?
Any ideas, why my second solution is slower?