Exploring Android 12: Permission Group Lookup
We are going to talk about a simple feature introduces in Android 12: Permission Group Lookup. With this, developers can determine:
- which permission group a permission belongs to; or
- which permissions belong to a certain permission group.
To achieve those, we are introduced to 2 new methods: getGroupOfPlatformPermission
and getPlatformPermissionsForGroup
.
In this article, we will create a simple application that demonstrates these 2 new methods. The end result can be seen in the image below:
ACCESS_FINE_LOCATION
permission and the permissions that belong to STORAGE
permission group.Where’s the Source Code?
Step by Step Explanation
Follow the steps provided below to create this application.
1. Open Android Studio. Create new project with “Empty Activity” option.
2. First, we need to update our layout, activity_main.xml
file. Here’s what it would look like:
activity_main.xml
should look like.Copy-paste the code snippet below to create that layout:
3. Lastly, update the MainActivity.kt
file. Go ahead and copy-paste the code snippet below. The most important things to notice here is the usage of getGroupOfPlatformPermission
and getPlatformPermissionsForGroup
methods. Take extra note on how the method callback was executed inside theExecutor
‘s thread (not in the main UI thread).
4. That’s it! Run your app and it should look like this:
ACCESS_FINE_LOCATION
permission and the permissions that belong to STORAGE
permission group.As always, thanks for reading!
—
Want to learn more about Android 12?
Check out all of our articles from “Exploring Android 12” series here:


