Search code examples
androidlive-wallpaper

call Live wallpaper within application


I am trying to implement following thing in android 2.x.

alt text

In my application i want to allow the user to create the custom live wallpaper kind of thing where user chooses few images and then those image will rotate in a typical fashion and after that user will be able to set it all the view as a live wallpaper within the application only.

i have successfully implemented the selection of images and its rotation now i don't know how to set live wallpaper within the application. i have tried implementing Live Wallpaper chooser but it is used to access already installed live wallpaper. but what about the dynamically created live wallpaper?

Even i tried to call it using following line of code

intent.setClassName("com.android.wallpaper.livepicker", "com.android.wallpaper.livepicker.LiveWallpaperPreview");

But it is giving me an error

java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.wallpaper.livepicker/.LiveWallpaperPreview } from ProcessRecord{43f94a38 29784:com.vb.ui/10038} (pid=29784, uid=10038) requires null

There might be few ways but m not sure about it

is it possible to install live wallpaper apk programmatically so that once the live wallpaper is created it is being installed by the application ?

if live wallpapers are stored in some place then we can store user created live wallpaper at that place so when live wallpaper chooser is being selected we can see the live wallpaper in the list


Solution

  • Maybe you should open this custom picking activity from within the standard "Settings" button a user sees when choosing your live wallpaper.

    1. User goes into standard live wallpaper chooser, sees a list of installed LWPs, picks yours.
    2. User sees your default implementation, chooses "Settings" button.
    3. You show a list of settings, one of which is a PreferenceScreen named "Pick Images."
    4. Assign an onClickListener to that preference item which launches your custom image picking activity.