3

I'm trying to change the wallpaper with an alarm, it sometimes works and sometimes doesn't, it doesn't show any error or other kind of logs in the console, checked for nulls and nothing.

Tried first without picasso and once I got the error I though it maybe an issue where the bitmap doesnt load before the wallpapermanager changes it, so I tried Picasso and the result is the same, sometimes works sometimes doesn't

Picasso.with(context).load(Uri.parse(uriString)).into(new Target() {
            @Override
            public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
                WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);

                try {
                    wallpaperManager.setBitmap(bitmap);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onBitmapFailed(Drawable errorDrawable) {
            }

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {
            }
        });

UPDATE:

Sometimes it also changes the wallpaper with an uncompleted image with a black margin on the right.

Any help would by appreciated. Thanks

MAC
  • 31
  • 3
  • Can you please add stackTrace as well – Mohan Sai Manthri Sep 12 '19 at 07:59
  • You mean the one of the exception? The exception is not triggered, or any kind of error. Console stays blank only showing the messages I put manually like if everything runs smooth – MAC Sep 12 '19 at 08:03

0 Answers0