Google I/O 2009 - Coding for Life -- Battery Life, That Is

By: Google Developers

153   8   71885

Uploaded on 06/03/2009

Google I/O 2009 - Coding for Life -- Battery Life, That Is

Jeffrey Sharkey

The three most important considerations for mobile applications are, in order: battery life, battery life, and battery life. After all, if the battery is dead, no one can use your application. In this session, Android engineer Jeffrey Sharkey will reveal the myriad ways -- many unexpected -- that your application can guzzle power and irritate users. You'll learn about how networking affects battery life, the right and wrong ways to use Android-specific features such as wake locks, why you can't assume that it's okay to trade memory for time, and more.

For presentation slides and all I/O sessions, please go to: code.google.com/events/io/sessions.html

Comments (4):

By anonymous    2017-09-20

There was a Google I/O session on this very subject a few years ago; you can see the video here and slides pdf here.

Original Thread

By anonymous    2017-09-20

WakeLock is a mechanism to keep the device on, as written here and here

It is used for example when you need to do things even when the device seems to be asleep, like downloading files from the internet.

Wakelocks should never be used unless you really need them. The reason is that they consume more battery, and if you have a bug that won't release them when needed, your app will keep consuming the battery of the device. There are even apps to detect such problematic apps (like "wakelock detector") .

Also, a small tip for people who just wish to let the screen stay on (as long as the app is shown): you don't need (and you shouldn't need) the wakeLock permission. Instead, you should just set "android:keepScreenOn="true"" on the layout of the current activity. More about this is talked about on the lecture "Coding for Life -- Battery Life, That Is" (presentation here)

Original Thread

Popular Videos 3775

GoogleTechTalks

Submit Your Video

If you have some great dev videos to share, please fill out this form.