螺纹螺纹内的服务,或者服务内?螺纹

由网友(し把心丟到海裏喂魚ㄦ)分享简介:我有一个关于服务问题:是什么更好的,创建一个线程内的服务中的一个线程,或服务I have a question about services: What would be better, create a thread within a service, or service within a thread?问题来...

我有一个关于服务问题:是什么更好的,创建一个线程内的服务中的一个线程,或服务

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 service, or service within a thread?

我觉得最好的是第一选择,但我看到了一个code在同一个Android的人,在这里:

I think the best is the first choice, but I saw a code in the same android people, here:

(线640)从谷歌code养活一个线程??

如果他们使用的第二位。你对此怎么看?

Where they use the second. What do you think about it?

我不需要一个AsyncTask的,因为我并不需要与UI线程交互,我没有显示在这一点上给用户任何东西。

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.

阅读全文

相关推荐

最新文章