Android APIs
public abstract class

WallpaperService

extends Service
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.wallpaper.WallpaperService

Class Overview

A wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it. This service object itself does very little -- its only purpose is to generate instances of WallpaperService.Engine as needed. Implementing a wallpaper thus involves subclassing from this, subclassing an Engine implementation, and implementing onCreateEngine() to return a new instance of your engine.

Summary

Nested Classes
class WallpaperService.Engine The actual implementation of a wallpaper. 
Constants
String SERVICE_INTERFACE The Intent that must be declared as handled by the service.
String SERVICE_META_DATA Name under which a WallpaperService component publishes information about itself.
[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
WallpaperService()
Public Methods
final IBinder onBind(Intent intent)
Implement to return the implementation of the internal accessibility service interface.
void onCreate()
Called by the system when the service is first created.
abstract WallpaperService.Engine onCreateEngine()
Must be implemented to return a new instance of the wallpaper's engine.
void onDestroy()
Called by the system to notify a Service that it is no longer used and is being removed.
Protected Methods
void dump(FileDescriptor fd, PrintWriter out, String[] args)
Print the Service's state into the given stream.
[Expand]
Inherited Methods
From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Constants

public static final String SERVICE_INTERFACE

Added in API level 7

The Intent that must be declared as handled by the service. To be supported, the service must also require the BIND_WALLPAPER permission so that other applications can not abuse it.

Constant Value: "android.service.wallpaper.WallpaperService"

public static final String SERVICE_META_DATA

Added in API level 7

Name under which a WallpaperService component publishes information about itself. This meta-data must reference an XML resource containing a <wallpaper> tag.

Constant Value: "android.service.wallpaper"

Public Constructors

public WallpaperService ()

Added in API level 7

Public Methods

public final IBinder onBind (Intent intent)

Added in API level 7

Implement to return the implementation of the internal accessibility service interface. Subclasses should not override.

Parameters
intent The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Returns
  • Return an IBinder through which clients can call on to the service.

public void onCreate ()

Added in API level 7

Called by the system when the service is first created. Do not call this method directly.

public abstract WallpaperService.Engine onCreateEngine ()

Added in API level 7

Must be implemented to return a new instance of the wallpaper's engine. Note that multiple instances may be active at the same time, such as when the wallpaper is currently set as the active wallpaper and the user is in the wallpaper picker viewing a preview of it as well.

public void onDestroy ()

Added in API level 7

Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead. Do not call this method directly.

Protected Methods

protected void dump (FileDescriptor fd, PrintWriter out, String[] args)

Added in API level 7

Print the Service's state into the given stream. This gets invoked if you run "adb shell dumpsys activity service <yourservicename>" (note that for this command to work, the service must be running, and you must specify a fully-qualified service name). This is distinct from "dumpsys <servicename>", which only works for named system services and which invokes the dump(FileDescriptor, String[]) method on the IBinder interface registered with ServiceManager.

Parameters
fd The raw file descriptor that the dump is being sent to.
out The PrintWriter to which you should dump your state. This will be closed for you after you return.
args additional arguments to the dump request.