Service
This is the base class for all services. When you extend this class, it's important that you create a new thread in which to do all the service's work, because the service uses your application's main thread, by default, which could slow the performance of any activity your application is running.
IntentService
This is a subclass of
Service that uses a worker thread to handle all start requests, one at a time. This is the best option if you don't require that your service handle multiple requests simultaneously. All you need to do is implement
onHandleIntent(), which receives the intent for each start request so you can do the background work.
理解Android服务与IntentService的区别
本文详细介绍了Android服务的基本概念及其子类IntentService的区别,强调了创建新线程进行服务工作的重要性,以及如何在IntentService中实现背景任务处理。
1470

被折叠的 条评论
为什么被折叠?



