What permissions and for what API versions are required to request a photo/video from the gallery using PhotoPicker with
registerForActivityResult(
ActivityResultContracts.PickMultipleVisualMedia())
?
The application supports Android 8 (API 26). If I understand correctly, Android 14 does not require permissions? But in other versions? I did not find any clear explanations about this in the documentation.
Yes, starting with Android 14 (API level 34), media selection (images, videos, etc.) no longer requires any permissions, as Android 14 has significantly streamlined access to media files.
No permissions required for media access:
READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, or READ_MEDIA_AUDIO
.PhotoPicker API:
PickMultipleVisualMedia API:
Scoped Storage is enforced:
Android 9 (API 28) and Below:
READ_EXTERNAL_STORAGE
, WRITE_EXTERNAL_STORAGE
.Android 10 (API 29):
READ_EXTERNAL_STORAGE
, Scoped Storage.MediaStore
). No PhotoPicker API.Android 11 (API 30):
READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, READ_MEDIA_AUDIO
.Android 12 (API 31):
READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, READ_MEDIA_AUDIO
.Android 13 (API 33):
READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, READ_MEDIA_AUDIO
.Android 14 (API 34):
These key notes outline the evolution of Scoped Storage, permissions for accessing media, and the introduction of PhotoPicker and PickMultipleVisualMedia across different Android versions.
And,
READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, READ_MEDIA_AUDIO
).