I would like to create my own LiveWallpaperPreview, i.e. to show the user a fullscreen preview of what the selected Live Wallpaper looks like (without the "Set Wallpaper" and "Settings" button that the stock-OS preview has).
Rebuilding the LivePicker-Class from 2.1 (android.git.kernel.org) works great, so I am able to let the user select a wallpaper to be previewed, but the actual LiveWallpaperPreview-Class tries to import the following private Interfaces/Classes:
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperService;
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.WallpaperSettingsActivity;
开发者_开发问答Is there any way to display a LiveWallpaper in my app without resorting to using the private APIs (which I obviously don't want to do)?
Thanks!
Nick
You cannot do this. The live wallpaper picker is part of the Android operating system and cannot be replaced.
Looking into the same problem, but also hit a dead end.
My idea was that I didn't need access to IWallpaperConnection etc., but that I could use reflection on the bound service.
However, I get WARN/ActivityManager(96): Permission Denial: Accessing service ComponentInfo{com.android.wallpaper/com.android.wallpaper.grass.GrassWallpaper} from pid=4196, uid=10070 requires android.permission.BIND_WALLPAPER
The permission android.permission.BIND_WALLPAPER is required for viewing the wallpaper and it is a system permission not available to normal apps.
EDIT: Created an app called Current Wallpaper that is available on the market https://market.android.com/details?id=com.elsewhat.android.currentwallpaper
It basically displays the current wallpaper in a standalone app and allows you to change the wallpaper through an intent to the standard wallpaper picker.
The app uses the theme android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
精彩评论