Android M runtime permissions utility class


Hello world, I prepared a PermissionsUtil.java class and it’s on GitHub.

Check it out: AndroidPermissionsUtil

Why use it? It will help by letting you write less code as you add conditions to your Android app that supports Android 6.0 (Marshmallow). The utility class defines helper methods that were used in the following example.

Sample usage of Android M PermissionUtils

On the activity where you need to check for runtime permissions, add these:

And add the callback function to the same activity:

Feel free to use in on any project. And please let me know if you have suggestions on how to improve that Android M runtime permissions utility class.

Catzie

A Filipino who is a mobile & web developer on weekdays, and a baker on weekends. When I have time to spare, I blog, play video games, watch series (usually anime), cook dishes, draw, or spend a little time with pets. I also like traveling and recording song covers, but I only do so occasionally. Follow on Twitter: @catzie

Leave a Reply

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