| Katie McCormick | 7bdb3f6 | 2013-09-05 14:46:20 -0700 | [diff] [blame] | 1 | page.title=Managing Device Awake State |
| smain@google.com | 852e0e34 | 2015-02-13 09:58:42 -0800 | [diff] [blame] | 2 | page.tags=wakelock, AlarmManager, WakefulBroadcastReceiver |
| Katie McCormick | 7bdb3f6 | 2013-09-05 14:46:20 -0700 | [diff] [blame] | 3 | |
| 4 | trainingnavtop=true |
| 5 | startpage=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" |
| 23 | class="button">Download the sample</a> |
| 24 | <p class="filename">Scheduler.zip</p> |
| 25 | </div> |
| 26 | |
| 27 | </div> |
| 28 | </div> |
| 29 | |
| 30 | <p> |
| 31 | When an Android device is left idle, it will first dim, then turn off the screen, and |
| 32 | ultimately turn off the CPU. This prevents the device's battery from quickly getting |
| 33 | drained. 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> |
| 45 | This class describes how to keep a device awake when necessary without draining |
| 46 | its 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> |