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