kotlinandroid-permissionsandroid-photo-picker

What permissions and for what API versions are required for PhotoPicker?


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.


Solution

  • 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.

    Key Points for Media Access in Android 14 (API level 34):

    1. Android 9 (API 28) and Below:

      • Permissions: READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE.
      • Key Notes: Full external storage access without restrictions. No Scoped Storage model, meaning apps can access all files without limitations.
    2. Android 10 (API 29):

      • Permissions: READ_EXTERNAL_STORAGE, Scoped Storage.
      • Key Notes: Scoped Storage introduced. Apps are restricted to access only their own private storage or shared media (via MediaStore). No PhotoPicker API.
    3. Android 11 (API 30):

      • Permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO.
      • Key Notes: Scoped Storage enforced with granular permissions for different types of media. The PhotoPicker API is introduced, allowing users to select images and videos more easily. Apps need to request specific media permissions for images, videos, and audio.
    4. Android 12 (API 31):

      • Permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO.
      • Key Notes: Granular media permissions continue. Scoped Storage is fully enforced, restricting file access further. Apps must request specific permissions for media access (e.g., images, videos). The PhotoPicker API remains available.
    5. Android 13 (API 33):

      • Permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO.
      • Key Notes: Granular permissions remain in place. The PickMultipleVisualMedia API is introduced, allowing users to select multiple images or videos at once.
    6. Android 14 (API 34):

      • Permissions: No permissions required for media access.
      • Key Notes: No permissions are needed for accessing media like images, videos, or audio. The PhotoPicker API continues with improvements to allow easier media selection. Further optimizations and user privacy features added.

    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,

    Key Points for PhotoPicker API and PickMultipleVisualMedia API Availability:

    1. Android 13 (API level 33) and above:

    2. Android 12 (API level 31):

    3. Android 11 (API level 30):

    4. Android 10 (API level 29) and below:

    5. Backporting for Android 4.4 to 10 (API 19-29) and Android Go Devices (with Android 11/12):