Android 13 - READ_EXTERNAL_STORAGE_PERMISSION still usable

Viewed 1611

The behaviour changes for Android 13 mention this:

If your app targets Android 13, you must request one or more new permissions instead of the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.

(https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions)

The new permissions are:

  • Images and photos: READ_MEDIA_IMAGES
  • Videos: READ_MEDIA_VIDEO Audio
  • Audio files: READ_MEDIA_AUDIO

But how to handle this, if I e.g. need to read PDF files from an arbitrary folder? There's no permission like READ_MEDIA_DOCUMENT or something like that. What about other file types, which are not images, videos or audio? Can I still use READ_EXTERNAL_STORAGE permission for them?

I didn't find any information about this in the official documentation, but to be honest the documentation is focusing on media files only without any word about other file types (https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions).

I am also not sure about WRITE_EXTERNAL_STORAGE permission for other document types beside of videos, images and audio.

1 Answers

According to documentation (https://developer.android.com/training/data-storage/shared/media#storage-permission):

"No permissions needed if you only access your own media files On devices that run Android 10 or higher, you don't need any storage-related permissions to access and modify media files that your app owns, including files in the MediaStore.Downloads collection. If you're developing a camera app, for example, you don't need to request storage-related permissions because your app owns the images that you're writing to the media store."

From android 10 you can not to ask permissions to get files from storage. Works perfectly with all kinds of files (pdf, exel...) on my app on android 13 without any permissions. So you just need to ask READ_EXTERNAL_STORAGE permission for SDK, less than android 10.

But if you need special files (for example which was created by Instagram app but not stored in usual storage) you should ask for permission from your list.

Also look for types of Media storages: https://developer.android.com/reference/android/provider/MediaStore

About WRITE_EXTERNAL_STORAGE - you don`t need it since SdkVersion=29

Related