Tag Archives: live wallpapers
Live wallpapers are fun and eye-catching, but an incorrect implementation of a live wallpaper can quickly drain the battery of any powerful Android™ phone. This tutorial will explain how big this problem can be, what the reasons are and show you a code example on how you can avoid this happening to your live wallpapers.
A live wallpaper in Android™ is implemented as an Android™ service and will stay alive running in the background as long as it is the currently active wallpaper. As a developer you will have access to hardware and framework components such as the camera, GPS, compass, accelerometer and 3D graphics, just as for any Android™ services and applications. The possibility to create a live wallpaper enhanced with visual effects and features are more or less unlimited. However, it must be remembered that from a power consumption perspective the more complex drawings and hardware features you add will affect the overall performance and battery life time since the Android™ framework will make sure that the live wallpaper service is kept alive forever. This is especially critical if the live wallpaper misbehaves in the background. The unintended power consumption can then quickly drain the battery and the user will be far from happy having to recharge the phone all too often.
Two examples
Let’s compare two live wallpapers in a test scenario where the user wakes up the phone from standby, switches to a live wallpaper and then puts the phone back to standby. The graph (ampere on Y-axis, time on x-axis) to the left shows a live wallpaper that handles the resources correct and the graph to the right shows a wallpaper that keeps listening for events from the orientation sensor even when it is put back to sleep.
From the graph to the left you can see that when all resources are turned off the live wallpaper is back to consuming as much current as before the phone woke up from sleep, around 3-5 mA in average. However, in the graph to the right the live wallpaper keeps listening to events from the orientation sensor even when the phone is put to sleep and the power consumption is around 35 mA in average.







