Drawing a wallpaper can be very expensive so you should optimize your code as much as possible to avoid using too much CPU, not only for battery life but also to avoid slowing down the rest of the system. The system provides you with a surface on which you can draw, just like you would with a SurfaceView. The engine is responsible for handling the lifecycle and the drawing of a wallpaper. The only difference is the addition of a new method, onCreateEngine() whose goal is to create a WallpaperService.Engine. To learn how to create a live wallpaper, you should check out the CubeLiveWallpaper sample provided with the Android 2.1 SDK you will find it in the directory platforms/android-2.1/samples/CubeLiveWallpaper.Ī live wallpaper is very similar to a regular Android service. For instance, the Grass wallpaper uses the phone's location to compute sunrise and sunset times in order to display the appropriate sky.Ĭreating your own live wallpaper is easy, especially if you have had previous experience with SurfaceView or Canvas. The live wallpapers included on Nexus One demonstrate the use of some of these APIs to create fun and interesting user experiences. A live wallpaper is very similar to a normal Android application and has access to all the facilities of the platform: SGL (2D drawing), OpenGL (3D drawing), GPS, accelerometers, network access, etc. With the introduction of live wallpapers in Android 2.1, users can now enjoy richer, animated, interactive backgrounds on their home screen.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |