I am developing an application that shows the different photos from server and user can set select photos as wallpaper of its device i used given code to set wallpaper it working but i want to wallpaper set automatically every day. I used this code.
Java
private void setAsWallpaper()
{
Picasso.get().load(imageUrl).into(new Target()
{
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from)
{
progressBar.bringToFront();
progressBar.setVisibility(View.VISIBLE);
WallpaperManager wallpaperManager = WallpaperManager.getInstance(SetWallPaperFullScreenActivity.this);
try
{
wallpaperManager.setBitmap(bitmap);
}
catch (IOException e)
{
e.printStackTrace();
}
Toast.makeText(SetWallPaperFullScreenActivity.this, "Wallpaper set successfully.", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
}
@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable)
{
Log.d("TAG", "Failed: ");
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable)
{
Log.d("TAG", "Prepare Load: ");
}
});
}