Search code examples
androidlive-wallpaper

how to set the Live Wallpaper as default wallpaper?


I created an live wallpaper application, like how we get default wallpaper on home screen, how to set the Live Wallpaper as default wallpaper even after my Android mobile is restarted?


Solution

  • Setting live wallpapers are reserved for platform applications, e.g. the live wallpaper picker bundled with the device (the permission android.permission.SET_WALLPAPER_COMPONENT is defined as signatureOrSystem).

    You're not going to be able to do this without either rooting the device. What you can do is show the wallpaper chooser to the user using this code:

    Intent intent = new Intent();
    intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
    startActivity(intent);
    

    You can show a notification to a user when a new wallpaper is available (or upon system boot) and when the user clicks that notification launch the chooser using the above code so he can select your wallpaper.