This chapter covers the animated LiveWallpaper API that allows developers to create interactive wallpaper that users may choose to run as part of their home page. We also cover handlers, an essential part of the Android thread system that enhances interactivity.
Android 2.1 (API Level 7) introduced live wallpaper. A live wallpaper is a wallpaper (a background set on the home screen) that may be animated and enabled for interaction. It has access to the other services and APIs as normal Android applications: network, GPS, etc. The primary class to use when creating a live wallpaper is the
LiveWallpaperService (located in
For an example, we will put together a live wallpaper that is touch-enabled and utilizes the Internet (via the Yamba Manager) in order to place some text at the point of touch. To do this, you must add a service definition within the main Manifest (see Example 16-1). Next, create a Service Resource (see Example 16-2).