1page.title=Managing Device Awake State
2page.tags=wakelock, AlarmManager, WakefulBroadcastReceiver
3
4trainingnavtop=true
5startpage=true
6
7
8@jd:body
9<div id="tb-wrapper">
10<div id="tb">
11
12<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
13<h2>Dependencies and prerequisites</h2>
14
15<ul>
16  <li>Android 1.6 (API Level 4) or higher</li>
17</ul>
18
19<h2>Try it out</h2>
20
21<div class="download-box">
22  <a href="{@docRoot}shareables/training/Scheduler.zip"
23class="button">Download the sample</a>
24 <p class="filename">Scheduler.zip</p>
25</div>
26
27</div>
28</div>
29
30<p>
31When an Android device is left idle, it will first dim, then turn off the screen, and
32ultimately turn off the CPU. This prevents the device's battery from quickly getting
33drained. Yet there are times when your application might require a different behavior:</p>
34
35<ul>
36
37<li>Apps such as games or movie apps may need to keep the screen turned on.</p>
38
39<li>Other applications may not need the screen to remain on, but they may require the CPU
40 to keep running until a critical operation finishes.</p>
41
42</ul>
43
44<p>
45This class describes how to keep a device awake when necessary without draining
46its battery.
47</p>
48<h2>Lessons</h2>
49
50<dl>
51    <dt>
52        <strong><a href="wakelock.html">Keeping the Device Awake</a></strong>
53    </dt>
54    <dd>
55        Learn how to keep the screen or CPU awake as needed, while minimizing the impact
56        on battery life.
57    </dd>
58    <dt>
59        <strong><a href="alarms.html">Scheduling Repeating Alarms</a></strong>
60    </dt>
61    <dd>
62        Learn how to use repeating alarms to schedule operations that take place outside
63        of the lifetime of the application, even if the application is not running and/or the
64        device is asleep.
65    </dd>
66</dl>
67