I have a question about services: What would be better, create a thread within a service, or service within a thread?
The question comes because I am implementing an error reporter for my application, so that when the application fails it sends me a report with what has happened. My idea is a notification when an error occurs from here show activity Activity and creates a thread to retry delivery until it succeeds or reaches a minimum number of attempts.
Remaking the question, how is the system least likely to remove my process (if out of memory): With a thread within a se开发者_如何学JAVArvice, or service within a thread?
I think the best is the first choice, but I saw a code in the same android people, here:
(line 640) code from google to keep alive a thread??
Where they use the second. What do you think about it?
I don't need an AsyncTask, because I don't need to interact with the UI thread, I'm not showing anything at this point to the user.
Create your worker thread inside the service.
精彩评论