WallpaperManager.GetWallpaperFile(WallpaperManagerFlags) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
<strong> Important note: </strong>
<ul>
<li>Up to Android 12, this method requires the
android.Manifest.permission#READ_EXTERNAL_STORAGE
permission.
[Android.Runtime.Register("getWallpaperFile", "(I)Landroid/os/ParcelFileDescriptor;", "GetGetWallpaperFile_IHandler", ApiSince=24)]
public virtual Android.OS.ParcelFileDescriptor? GetWallpaperFile (Android.App.WallpaperManagerFlags which);
[<Android.Runtime.Register("getWallpaperFile", "(I)Landroid/os/ParcelFileDescriptor;", "GetGetWallpaperFile_IHandler", ApiSince=24)>]
abstract member GetWallpaperFile : Android.App.WallpaperManagerFlags -> Android.OS.ParcelFileDescriptor
override this.GetWallpaperFile : Android.App.WallpaperManagerFlags -> Android.OS.ParcelFileDescriptor
Parameters
- which
- WallpaperManagerFlags
The wallpaper whose image file is to be retrieved. Must be a single
defined kind of wallpaper, either #FLAG_SYSTEM
or
#FLAG_LOCK
.
Returns
An open, readable file descriptor to the requested wallpaper image file;
or null
if no such wallpaper is configured or if the calling app does
not have permission to read the current wallpaper.
- Attributes
Remarks
<strong> Important note: </strong> <ul> <li>Up to Android 12, this method requires the android.Manifest.permission#READ_EXTERNAL_STORAGE
permission.</li> <li>Starting in Android 13, directly accessing the wallpaper is not possible anymore, instead the default system wallpaper is returned (some versions of Android 13 may throw a SecurityException
).</li> <li>From Android 14, this method should not be used and will always throw a SecurityException
.</li> <li> Apps with android.Manifest.permission#MANAGE_EXTERNAL_STORAGE
can still access the real wallpaper on all versions. </li> </ul> <br>
Get an open, readable file descriptor to the given wallpaper image file. The caller is responsible for closing the file descriptor when done ingesting the file.
If no lock-specific wallpaper has been configured for the given user, then this method will return null
when requesting #FLAG_LOCK
rather than returning the system wallpaper's image file.
Java documentation for android.app.WallpaperManager.getWallpaperFile(int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.