Android 13 Downgradable Permissions

Updated 1 June 2023

Save

In this blog, we are learning that the ‘Downgradable permissions’ in Android apps. You can disable runtime permissions that your app no longer needs on Android 13 (API level 33) and higher. Perform this action when you update your app so that users are more likely to comprehend why your program keeps asking for particular permissions.

Use the command revokeSelfPermissionOnKill(String) to revoke ONE privilege.
Use revokeSelfPermissionsOnKill(Collection) to revoke MULTIPLE permissions.

Next, in our AndroidManifest.xml file, we must define a few runtime permissions. In our app, these permissions will be requested at runtime. We will use the MANAGE_EXTERNAL_STORAGE and ACCESS_FINE_LOCATION permissions in this post.

We have added these run time permission in the manifest file, now we are creating the XML layout to show the button to Permission GRANT or REVOKE.

XML layout

In this code, we are seeing, we have created two buttons first one to give all required permissions, and the second one is to revoke all given permissions.

 MainActivity.kt file.

We are creating a permissions list.

now we are declaring the permission request code and the revoke code.

Remember that the permissions that have been revoked MUST BE GRANTED FIRST! The methods will throw an Exception if not.

Conclusion

Congratulations!! 🤩 You have mastered the Android 13 Downgradable Permissions.

Visit the link for additional information on the Downgradable Permissions in Android 13.

Thanks for reading this blog. You can also check other blogs from here for more knowledge.

Always be ready for learning 🙂

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home