Reputation: 1086
I want to make a service which can set wallpaper every day on the Android device Home Screen.
How can we do this? Any help is appreciated.
Upvotes: 2
Views: 1524
Reputation: 132992
for Change Wallpaper programmatically you need following setps in Activity or Service:
Step 1:AndroidManifest.xml
<uses -permission android:name="android.permission.SET_WALLPAPER" />
Step 2: in Activity or Service
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
Drawable drawable = getResources().getDrawable(R.id.wallpaper);
Bitmap wallpaper = ((BitmapDrawable) drawable).getBitmap();
wallpaperManager.setBitmap(wallpaper);
Step 3:
use AlarmManager for Changeing Wallpaper everyday
Upvotes: 5
Reputation: 297
The following code changes the home screen wall paper. Run you service when date changes as per your requirement.
WallpaperManager wm = WallpaperManager.getInstance(this); wm.setBitmap(myBitmap);
Upvotes: 2