2
public HeavyLifter(Context context, Handler callback) {
        this.context = context;
        this.callback = callback;
        this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);
    }

Error: Suspicious cast to WallpaperManager for a WALLPAPER_SERVICE: expected WallpaperService [ServiceCast] this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);

How can i resolve this issue ?

earthw0rmjim
  • 19,027
  • 9
  • 49
  • 63

1 Answers1

0

You should use the getInstance() method of WallpaperManager to get ahold of an instance.

Change the following:

this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);

To this:

this.manager = WallpaperManager.getInstance(context);
earthw0rmjim
  • 19,027
  • 9
  • 49
  • 63