Files
frameworks_base/docs/html/training/run-background-service/index.jd
George French 9748d76be9 docs: Update startService() & bindService() documentation (Proj13)
Updated Update startService() and bindService() docs to mention that they
no longer support implicit intent. And mentioned that the  Intellegent
job scheduling is now the preferred method for launching services.
We also performed a copy edit, implementing Google styles.

Bug:  18333456
Change-Id: I2b2ec666be870aea15045d30fbc822256d1b9a81
2016-10-24 11:49:41 -07:00

79 lines
2.7 KiB
Plaintext

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. Long-running foreground operations can cause problems
and interfere with the responsiveness of your user interface, which 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 that runs 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>
<p class="note"><strong>Note:</strong> If your app targets Android 5.0 (API level 21),
you should use {@link android.app.job.JobScheduler} to execute background
services. For more information about this class,
see the {@link android.app.job.JobScheduler} reference documentation.</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>