Handle Android Permissions with a single line of code | No BS Tutorials
Welcome to No BS Tutorials. Here you will get “To the Point” tutorials with no BS involved.
A detailed tutorial with thourough explanation will be found on my blog.
This tutorial will be in Kotlin
Introduction
Since Android 6 (Marshmellow) app developers have to ask for various permission like storage, camera, mic, location etc before they can be used/accessed.
Although handling permission is not a straight forward task & involves a lot of lines of code & its subsequent handling thereafter.
Goal
We will use permissions-android wrapper library to ask system permission in a single line of code
Getting Started
- Add the permissions-android library in your app.gradle (always check for latest version)
implementation 'org.sourcei.android:permissions:1.0.1'
- Whenever you need to ask for a permission eg storage simple call
Conclusion
And that's all to it. It is so simple to handle various permissions with this library.
You can even ask multiple permissions in a go, check out the library on Github to know more
Wrap Up
Once again if you wish to know in more detail about this entire tutorial visit my blog.
Thanks a lot for tuning in today, for more tutorials follow this publication or subscribe to my blog.