Open In App

Granular Media Permissions in Android 13

Last Updated : 26 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

If you are developing or upgrading your app for Android 13 then you will need to have allowed the more granular permission which is newly introduced in the Android 13 SDK. Using these new APIs the user will tend to have better control over the data which he/she shares with your app, this is again done keeping privacy in mind. Based on the type of file your app wishes the user to pick, you will be needing to update your app accordingly, also you might even need to upgrade some other components of the app if you need to overhaul the user to be better on the Android 13 platform.

The Table Below shows which type of media file needs which new type of request to be associated in order to get working on Android 13, this change affects all the applications so it becomes vital to understand the newly introduced methods. 

Your Media Type

The Request Type

Images & Videos READ_MEDIA_IMAGES
Audio READ_MEDIA_AUDIO
Videos READ_MEDIA_VIDEO

One system permission box opens if you simultaneously request the READ MEDIA IMAGES and READ MEDIA VIDEO permissions. Let’s discuss each of them in detail:

  1. The READ_MEDIA_IMAGES permission: Starting with API level Build.VERSION CODES.TIRAMISU, this permission is required. The READ EXTERNAL STORAGE permission is not necessary for an app that targets Build.VERSION CODES.TIRAMISU or higher and needs to read picture files from external storage.
  2. The READ_MEDIA_AUDIO permission: Starting with API level Build.VERSION CODES.TIRAMISU, this permission is required. The READ EXTERNAL STORAGE permission is not necessary for an app that targets Build.VERSION CODES.TIRAMISU or higher and needs to access audio files from external storage.
  3. The READ_MEDIA_VIDEO permission: Starting with API level Build.VERSION CODES.TIRAMISU, this permission is required. The READ EXTERNAL STORAGE permission is not necessary for an app that targets Build.VERSION CODES.TIRAMISU or higher and needs to access video files from external storage. 

Now as we know just about every one of them, we can move forward to understand why these dangerous permissions are used and do you need to use them to keep your app functional going Android 13+.

How to check for upgraded permission in Android 13 using the ADB in the Android Terminal:

Any required READ MEDIA permissions are automatically provided when your app is upgraded if the READ EXTERNAL STORAGE permission has already been granted. For a review of enhanced permissions, use the ADB command:

adb shell cmd appops get --uid GFG_APP_FILE_PATH_NAME
Image #1: Understanding which SDK Version we need

Image #1: Understanding which SDK Version we need

GeekTip: You should always verify whether any rights are still granted rather than keeping their grant states, so keep that in mind. With apps going dormant and permissions expiring

The Actual Use Case of This Granular Permissions

It is advised to use the new photo picker rather than asking for access to all media files, but your app may have a use case that calls for this wide access (e.g. gallery photo backup). For these particular uses, special permissions are added that grant access to particular media file types, such as photos, videos, or audio. When targeting Android 13 or higher, the advertising ID also s automatically removed and replaced with a string of zeroes if your app does not declare this permission.

The permission is automatically combined with your app’s manifest file if your SDKs use the library’s manifest to specify the AD ID permission. In this situation, you are exempt from including a permission declaration in your app’s manifest file. Based on recent internal testing and consultation with Android developers, Android 13 offers revised lists of banned non-SDK interfaces. Before limiting non-SDK interfaces, we want to make sure that there are open alternatives. As with the image shown above, you can decide which one to use in order to get your application working in no time.

Conclusion

We are continuously moving towards stricter permissions, which continue to get more granular, like the auto hibernating permission introduced in Android 11, followed by the newer one-time permission in Android 12, and then now, we are moving towards the granular permissions, which are segregated already deeply around the system. Hope this article provided you insight into the level of sophistication Android 13 brings to the devices and to which level user privacy is taken care of.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads