# Android 13 Storage Permissions with Granular Media Access

> Request granular media permissions in Android 13 using READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO instead of the deprecated storage permissions

**URL:** https://sentry.io/answers/storage-permissions-in-android-13/

---

## The Problem

In Android 13, Google revamped storage permission requests for better control over accessing specific media types. The change was made to give users with privacy concerns more control over what they want to share with any particular app.

Previously, we needed to add these permissions to the `AndroidManifest.xml` file to access any media type:

```xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
```

These permissions no longer affect devices running Android 13 and above.

## The Solution

If you target [API 33 (Android 13) or higher](https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions), you must add these permissions to `AndroidManifest.xml`:

```xml
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
```

Only add the ones that you need and request permissions in the code. For example:

```kotlin
requestPermissions(
  arrayOf(
    Manifest.permission.READ_MEDIA_AUDIO,
    Manifest.permission.READ_MEDIA_IMAGES,
    Manifest.permission.READ_MEDIA_VIDEO,
  ),
  REQUEST_CODE
)
```

For more information about accessing media files please visit [https://developer.android.com/training/data-storage/shared/media#storage-permission](https://developer.android.com/training/data-storage/shared/media#storage-permission).

---

*Source: [sentry.io/answers/storage-permissions-in-android-13/](https://sentry.io/answers/storage-permissions-in-android-13/)*
