i can change home screen wallpaper but i can not change lock screen wallpaper,
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
// get the height and width of screen
int height = metrics.heightPixels;
int width = metrics.widthPixels;
WallpaperManager wallpaperManager = WallpaperManager
.getInstance(getApplicationContext());
wallpaperManager.setBitmap(bitmap);
wallpaperManager.suggestDesiredDimensions(width, height);
As of the latest Android API 24 it is possible to update the Lockscreen
wallpaper by using the WallpaperManager
and providing the FLAG_LOCK
flag.
wallpaperManager.setBitmap(bitmap, null, true, WallpaperManager.FLAG_LOCK)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With