I tried to use getCropAndSetWallpaperIntent method but I got an error.
Here is my code :
Uri uri = Uri.parse("content://" + getFilesDir() + "/"+ image.path);
ContentResolver contentResolver = getContentResolver();
contentResolver.getType(uri); // Type is null
Intent intent = wallpaperManager.getCropAndSetWallpaperIntent(uri);
intent.setType("image/*");
startActivityForResult(intent, 42);
Here is what I got in my logs :
java.lang.IllegalArgumentException: Cannot use passed URI to set wallpaper; check that the type returned by ContentProvider matches image/*
Can you help me please?
You have to query the MediaStore without using the "content://" protocol, for instance like this (code can be improved):