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.
Important note: Up to Android 12, this method requires the 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
int: The wallpaper whose image file is to be retrieved. Must be a single defined kind of wallpaper, either FLAG_SYSTEM or FLAG_LOCK. Value is either 0 or a combination of the following: FLAG_SYSTEM 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
Important note: Up to Android 12, this method requires the Manifest.permission.READ_EXTERNAL_STORAGE permission. 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). From Android 14, this method should not be used and will always throw a SecurityException. Apps with Manifest.permission.MANAGE_EXTERNAL_STORAGE can still access the real wallpaper on all versions. 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. Requires Manifest.permission.MANAGE_EXTERNAL_STORAGE or android.Manifest.permission.READ_WALLPAPER_INTERNAL
See also:
Throws: SecurityException as described in the note
Android reference for android.app.WallpaperManager.getWallpaperFile.
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.