public abstract class AndroidLiveWallpaperService
extends android.service.wallpaper.WallpaperService
Application interface dedicated for android live wallpapers.
Derive from this class. In the onCreateApplication() method call the
initialize(ApplicationListener) method specifying the configuration for the GLSurfaceView.
You can also use AndroidWallpaperListener along with ApplicationListener to respond for wallpaper specific
events in your app listener:
MyAppListener implements ApplicationListener, AndroidWallpaperListener
Notice: Following methods are not called for live wallpapers: ApplicationListener.pause()
ApplicationListener.dispose() TODO add callbacks to AndroidWallpaperListener allowing to notify app listener about
changed visibility state of live wallpaper but called from main thread, not from GL thread: for example:
AndroidWallpaperListener.visibilityChanged(boolean)
//obsoleted: //Notice! //You have to kill all not daemon threads you created in ApplicationListener.pause() method. //
ApplicationListener.dispose() is never called! //If you leave live non daemon threads, wallpaper service wouldn't be
able to close, //this can cause problems with wallpaper lifecycle.
Notice #2! On some devices wallpaper service is not killed immediately after exiting from preview. Service object is destroyed
(onDestroy called) but process on which it runs remains alive. When user comes back to wallpaper preview, new wallpaper service
object is created, but in the same process. It is important if you plan to use static variables / objects - they will be shared
between living instances of wallpaper services'! And depending on your implementation - it can cause problems you were not
prepared to.| Modifier and Type | Class and Description |
|---|---|
class |
AndroidLiveWallpaperService.AndroidWallpaperEngine
Bridge between surface on which wallpaper is rendered and the wallpaper service.
|
| Modifier and Type | Field and Description |
|---|---|
protected AndroidLiveWallpaper |
app |
protected int |
engines |
protected boolean |
isPreviewNotified |
protected AndroidLiveWallpaperService.AndroidWallpaperEngine |
linkedEngine |
protected boolean |
notifiedPreviewState |
protected android.view.SurfaceHolder.Callback |
view |
protected int |
viewFormat |
protected int |
viewHeight |
protected int |
viewWidth |
protected int |
visibleEngines |
SERVICE_INTERFACE, SERVICE_META_DATASTART_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVEACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CROSS_PROFILE_APPS_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE| Constructor and Description |
|---|
AndroidLiveWallpaperService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
finalize() |
AndroidLiveWallpaper |
getLiveWallpaper() |
android.view.SurfaceHolder |
getSurfaceHolder()
Getter for SurfaceHolder object, surface holder is required to restore gl context in GLSurfaceView
|
android.view.WindowManager |
getWindowManager() |
void |
initialize(com.badlogic.gdx.ApplicationListener listener)
|
void |
initialize(com.badlogic.gdx.ApplicationListener listener,
AndroidApplicationConfiguration config)
This method has to be called in the
onCreateApplication() method. |
void |
onCreate()
Service is starting, libGDX application is shutdown now
|
void |
onCreateApplication()
libGDX application is starting, it occurs after first wallpaper engine had started.
|
android.service.wallpaper.WallpaperService.Engine |
onCreateEngine()
One of wallpaper engines is starting.
|
void |
onDeepPauseApplication()
Called when the last engine is ending its live, it can occur when: 1.
|
void |
onDestroy()
Service is dying, and will not be used again.
|
protected void |
setLinkedEngine(AndroidLiveWallpaperService.AndroidWallpaperEngine linkedEngine) |
getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResultattachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiverprotected volatile AndroidLiveWallpaper app
protected android.view.SurfaceHolder.Callback view
protected int viewFormat
protected int viewWidth
protected int viewHeight
protected int engines
protected int visibleEngines
protected volatile AndroidLiveWallpaperService.AndroidWallpaperEngine linkedEngine
protected volatile boolean isPreviewNotified
protected volatile boolean notifiedPreviewState
protected void setLinkedEngine(AndroidLiveWallpaperService.AndroidWallpaperEngine linkedEngine)
public void onCreate()
onCreate in class android.service.wallpaper.WallpaperServicepublic android.service.wallpaper.WallpaperService.Engine onCreateEngine()
onCreateEngine in class android.service.wallpaper.WallpaperServicepublic void onCreateApplication()
initialize(ApplicationListener, AndroidApplicationConfiguration) from there.public void initialize(com.badlogic.gdx.ApplicationListener listener)
listener - public void initialize(com.badlogic.gdx.ApplicationListener listener,
AndroidApplicationConfiguration config)
onCreateApplication() method. It sets up all the
things necessary to get input, render via OpenGL and so on. You can configure other aspects of the application with the rest
of the fields in the AndroidApplicationConfiguration instance.listener - the ApplicationListener implementing the program logicconfig - the AndroidApplicationConfiguration, defining various settings of the application (use accelerometer,
etc.). Do not change contents of this object after passing to this method!public android.view.SurfaceHolder getSurfaceHolder()
public void onDeepPauseApplication()
public void onDestroy()
onDestroy in class android.service.wallpaper.WallpaperServiceprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic AndroidLiveWallpaper getLiveWallpaper()
public android.view.WindowManager getWindowManager()