␡
- What is an Android Service? / What Is an <tt>IntentService</tt>?
- When Should You Consider Using <tt>IntentService</tt>?
- A Simple <tt>IntentService</tt> Example
Like this article? We recommend
When Should You Consider Using IntentService?
Certainly, not all applications require or use a Service, or more specifically an IntentService. However, you may want to consider one if your application meets certain criteria, such as:
- The application routinely performs the same or similar blocking or resource-intensive processing operations that do not require input from the user in which requests for such operations can “pile up,” requiring a queue to handle the requests in an organized fashion.
- The application performs certain blocking operations at regular intervals but does not need to perform these routine tasks so frequently as to require a permanent, “always on” Servicefor example, accessing local storage, accessing a content provider, application database, or network, or some heavy image processing or math to chug through.
- The application routinely dispatches “work” but doesn’t need an immediate response. For example, an email application might use an IntentService work queue to queue up each message to be packaged up and sent out to a mail server. All networking code would then be separated from the main user interface of the application.