The most important APIs used in live wallpapers are as follows:
- android.app.WallpaperManager: This allows you to access the system wallpaper. You may acquire the current wallpaper, set the wallpaper, and get the desired wallpaper dimensions, among other things.
- android.service.wallpaper.WallpaperService: The android.service.wallpaper.The WallpaperService object is in charge of displaying a live wallpaper, although it only generates instances of WallpaperService.The engine when necessary.
You must enable the feature android.software.live wallpaper in the app's AnroidManifest.xml, as shown in the sample below. You must claim that the android.service.wallpaper.WallpaperService provides android.permission.BIND WALLPAPER permission in order to use the wallpaper service. The wallpaper is then specified by a different file inside the "xml" subfolder called "mylwp main.xml."
<manifest xmlns_android="http://schemas.android.com/apk/res
/android"
package="com.chunyenliu.tutorialonlwp">
<uses-feature android_name="android.software.live_wallpaper"
android_required="true" />
<application
android_allowBackup="true"
android_icon="@mipmap/ic_launcher"
android_label="@string/app_name"
android_roundIcon="@mipmap/ic_launcher_round"
android_supportsRtl="true"
android_theme="@style/AppTheme">
<service
android_label="MyLWPService"
android_name=".MyLWPService"
android_permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android_name=
"android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data android_name="android.service.wallpaper"
android_resource="@xml/mylwp_main" />
</service>
...(code snipped)
</application>
</manifest>
So what data is contained in "mylwp main.xml"? We can explain this live wallpaper's purpose and how to set it up on Android: settingsActivity, "com.chunyenliu.tutorialonlwp.MyLWPSettings," specifies how it should work in the activity..
<wallpaper
xmlns_android="http://schemas.android.com/apk/res/android"
android_thumbnail="@drawable/boids"
android_description="@string/mylwp_description"
android_settingsActivity="com.chunyenliu.tutorialonlwp
.MyLWPSettings"
/>