Set image as wallpaper without using WallpaperManager

902 views Asked by At

There's a lot of sample code on how to set an image as a wallpaper using the Intent.ACTION_ATTACH_DATA, but none of them are working for me with the new google photos app.

I'm trying to do this from a notification. The user saves an image to the gallery, a notification pops when the image is saved, and when the user clicks the "set as" action in the notification it should show the "set as" window.

All of this is working except for the actual part of setting the image as a wallpaper.

Whenever I start the intent I get the usual list of options:

enter image description here

When I choose the google photos "Wallpaper" option I get a crop window like this:

enter image description here

This is not a "set as wallpaper" window it just modifies the photo I just saved to the gallery.

All the other options like "home screen" , "lock screen" and "home and lock screen" work but they use a lower resolution.

What am I missing?

This is my code (my image type is png)

//Set as Intent
Intent setAsIntent = new Intent(Intent.ACTION_ATTACH_DATA);
setAsIntent.setDataAndType(uri, "image/*");

//PendingIntent to be used with the notification
PendingIntent setAsPendingIntent =
                PendingIntent.getActivity(
                        getContext(),
                        1,
                        Intent.createChooser(setAsIntent, "Set as: "),
                        PendingIntent.FLAG_UPDATE_CURRENT
                );
0

There are 0 answers