Android Runtime Permission Tutorial with Example

By | June 12, 2019

RuntimePermission in Android Tutorial Example

Runtime Permission is  introduction of Android 6.0 Marshmallow. Google has changed the way permissions are handled by the app. Runtime permission is users are prompted for some specific permissions at runtime when they become necessary to use. In this prompt to ask user allow or deny.

Your device is working with Android 6.0 Marshmallow (API 23) handle new permission framework. you can ask permission prompt dialog and the two options is allow or deny. you can click on allow to granted permission in you app installation and you can deny to permission is denied and it is not granted and it can not use this installation app.

you can also grant or revoke permission anytime from settings.

Permission Level in Android

Two type of permission level first is normal permission and second is dangerous permission.

Normal Permission : In this permission is very little or zero effect on users privacy or security are categorized as normal permissions.  Example of ACCESS_WIFI_STATE etc.

Dangerous Permission : In this Permission is greater effect on users privacy or security are categorized as dangerous permissions.  Example of READ_CONTACTS.

Example of Runtime Permission Marshmallow in Android

Declare Permissions in AndroidManifest.xml File.

Create activity_main.xml File Follow this Code.

Create File Follow this Code.

Runtime permission Marshmallow in Android Example

In this Example of Create Runtime Permission in android. i have declared some permission in manifest file and then create some method to check permission is granted or not and display user permission dialog show to user can ask allow or deny permission in android.