0

I want to set the wallpaper on phone boot. How can I do that ?

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Alexander Fuchs
  • 1,358
  • 3
  • 19
  • 36

3 Answers3

3

In your manifest add this permission:

<uses -permission android:name="android.permission.SET_WALLPAPER" />

Later in your code:

WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);

Drawable drawable = getResources().getDrawable(R.drawable.wallpaper);

Bitmap wallpaper = ((BitmapDrawable) drawable).getBitmap();

wallpaperManager.setBitmap(wallpaper);
Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109
2

You can use this method to set the wallpaper. Remember to put the wallpaper image in the res/raw directory.(You can add this manually if it hasn't been made yet)

public void setWall(){

InputStream wall = getResources().openRawResource(wallpaper);

Bitmap back = BitmapFactory.decodeStream(wall);

try {

getApplicationContext().setWallpaper(back);

}

catch(IOException e) {

e.printStackTrace();

}}

and ofcourse set the permission in the manifest with this:

<uses-permission android:name="android.permission.SET_WALLPAPER"/>

This will set the wallpaper to your phone and will stay after a reboot.

crognar
  • 65
  • 1
  • 7
0

use scheduler of android mostly crontab

write a script to pick wallpaper from a location

on a condition like change in date

schedule this script into the scheduler at a particular time

so it will run at that time of day and will do your job

maxjackie
  • 22,386
  • 6
  • 29
  • 37
  • I think the question was to set the wallpaper at **Boot** time.... However information regarding crontab may be helpful in some cases....thanks for that!!! – Amit Feb 20 '12 at 10:04