energy efficiency of android

19
Understanding Energy Efficiency of Android Apps (and how to Improve it) Aditya Kulkarni

Upload: littleeye

Post on 20-Jun-2015

1.257 views

Category:

Technology


3 download

DESCRIPTION

Understanding Energy Efficiency of Android Apps

TRANSCRIPT

Page 1: Energy efficiency of android

Understanding Energy Efficiency of Android Apps

(and how to Improve it)

Aditya Kulkarni

Page 2: Energy efficiency of android

Apps are to blame the most for bad battery life• Bad coding patterns

cause power bugs• Specific behaviors of the

Android Platform• App inter-dependencies!• Special Attention must

be paid to optimize for power!

Page 3: Energy efficiency of android

Users Hate “Power Bugs”

Page 4: Energy efficiency of android

Energy Consumption of An Android Phone

Page 5: Energy efficiency of android

Understanding Power Bugs

Page 6: Energy efficiency of android

Screen• color matters!– esp on OLED screens– darker the color, lesser

the consumption• brightness levels have

more impact– refer to -

http://stackoverflow.com/questions/5032588/cant-apply-system-screen-brightness-programmatically-in-android

Page 7: Energy efficiency of android

Screen• programmatically

reduce brightness if its suits your app/activity

• Use “night mode” for reading Apps

• Think about your color scheme

Page 8: Energy efficiency of android

CPU• wakelocks are your friend,

but your users worst nightmare!

• use them only if really needed and ensure they are removed as soon as possible

• Use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically

Page 9: Energy efficiency of android

CPU• if possible, spread out your

computationally intensive job

• gpu typically consumes more power than cpu– avoid floating point math

where possible• use algorithms that

consume less CPU cycle– O(n log n) vs O(n 2)

algorithms

Page 10: Energy efficiency of android

Wireless Radios• 3G/4G LTE have tail

states and warm-up times

• Power States are controlled by the Carrier

• Batching, state checks are your friend!

Page 11: Energy efficiency of android

GPS and Location Services• GPS is fairly heavy• Getting a location fix is far

more expensive than maintaining a fix

• Registering for notifications can have cascading effects

• Use Play Services Location APIs

Page 12: Energy efficiency of android

Best Practices(or how to avoid the dreaded battery drain)

Page 13: Energy efficiency of android

Common Power Bugs 1. Not Sleeping Properly

Page 14: Energy efficiency of android

Common Power Bugs 2. Un-necessary Animations

Page 15: Energy efficiency of android

Common Power Bugs 3. Updating the Screen

Page 16: Energy efficiency of android

Common Power Bugs 4. Handling Display-Off

Page 17: Energy efficiency of android

Common Power Bugs 5. Waking up to notifications

Page 18: Energy efficiency of android

Use A Power Profiler Like Little Eye

Page 19: Energy efficiency of android

Thank Youwww.littleeye.co

[email protected]