blob: 22f3fc875c3697212b29e11be30f4b07120993f1 [file] [log] [blame]
page.title=Running in a Background Service
page.tags=intentservice
trainingnavtop=true
startpage=true
@jd:body
<div id="tb-wrapper">
<div id="tb">
<h2>Dependencies and prerequisites</h2>
<ul>
<li>Android 1.6 (API Level 4) or higher</li>
</ul>
<h2>You should also read</h2>
<ul>
<li>
<a href="{@docRoot}guide/components/services.html#ExtendingIntentService">Extending the IntentService Class</a>
</li>
<li>
<a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a>
</li>
</ul>
<h2>Try it out</h2>
<div class="download-box">
<a href="{@docRoot}shareables/training/ThreadSample.zip" class="button">Download the sample</a>
<p class="filename">ThreadSample.zip</p>
</div>
</div>
</div>
<!-- ------------------------------------------------------------------------------------------- -->
<!-- Introduction -->
<!-- ------------------------------------------------------------------------------------------- -->
<p>
Unless you specify otherwise, most of the operations you do in an app run in the foreground on
a special thread called the UI thread. This can cause problems, because long-running operations
will interfere with the responsiveness of your user interface. This annoys your users, and can
even cause system errors. To avoid this, the Android framework offers several classes that
help you off-load operations onto a separate thread running in the background. The most useful
of these is {@link android.app.IntentService}.
</p>
<p>
This class describes how to implement an {@link android.app.IntentService}, send it work
requests, and report its results to other components.
</p>
<h2>Lessons</h2>
<dl>
<dt>
<b><a href="create-service.html">Creating a Background Service</a></b>
</dt>
<dd>
Learn how to create an {@link android.app.IntentService}.
</dd>
<dt>
<b><a href="send-request.html">Sending Work Requests to the Background Service</a></b>
</dt>
<dd>
Learn how to send work requests to an {@link android.app.IntentService}.
</dd>
<dt>
<b><a href="report-status.html">Reporting Work Status</a></b>
</dt>
<dd>
Learn how to use an {@link android.content.Intent} and a
{@link android.support.v4.content.LocalBroadcastManager} to communicate the status of a
work request from an {@link android.app.IntentService} to the
{@link android.app.Activity} that sent the request.
</dd>
</dl>