Upload
littleeye
View
1.258
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Understanding Energy Efficiency of Android Apps
Citation preview
Understanding Energy Efficiency of Android Apps
(and how to Improve it)
Aditya Kulkarni
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!
Users Hate “Power Bugs”
Energy Consumption of An Android Phone
Understanding Power Bugs
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
Screen• programmatically
reduce brightness if its suits your app/activity
• Use “night mode” for reading Apps
• Think about your color scheme
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
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
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!
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
Best Practices(or how to avoid the dreaded battery drain)
Common Power Bugs 1. Not Sleeping Properly
Common Power Bugs 2. Un-necessary Animations
Common Power Bugs 3. Updating the Screen
Common Power Bugs 4. Handling Display-Off
Common Power Bugs 5. Waking up to notifications
Use A Power Profiler Like Little Eye
Thank Youwww.littleeye.co