VOOZH about

URL: https://www.geeksforgeeks.org/android/easy-runtime-permissions-in-android-with-dexter/

⇱ Easy Runtime Permissions in Android with Dexter - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Easy Runtime Permissions in Android with Dexter

Last Updated : 23 Jul, 2025

The Runtime Permission in Android which introduced in Marshmallow and due to these runtime permissions users can grant permission to the app in runtime, also while writing the code for runtime permissions. Sometimes handling the task of requesting permissions becomes so difficult and the developer has to write a huge amount of code. So we will see the Implementation of Runtime Permissions in Android using Dexter

What is Dexter in Android?

Dexter is the library that will help us to make this task easy for handling Runtime Permissions in Android. Now we will see the implementation of this in our Android Application. 

What are we going to Build in this Article? 

We will be building a simple application in which we will be showing a button to the user. After clicking on that button we will display runtime permissions to the user. So if the users deny the permission then we are showing the option to open the settings screen and grant the permissions. Below is the short video in which we will see what we will build in this article.

Step by Step Implementation

Step 1: Create a New Project in Android Studio

To create a new project in Android Project just refer to this article on How to Create New Project in Android Studio. The code has been given in both Java and Kotlin Programming Language for Android.

Step 2: Add Dependency of Dexter Runtime Permissions in build.gradle File

Navigate to gradle scripts and then to build.gradle(Module) level. Add below line in build.gradle file in the dependencies section.

implementation 'com.karumi:dexter:6.2.2'

After adding this dependency now sync your project. Let's move toward the XML part. 

Step 3: Working with the activity_main.xml File

Go to the activity_main.xml File and refer to the following code. Below is the code for the activity_main.xml File.

Step 4: Working with the MainActivity File

Go to the MainActivity File and refer to the following code. Comments are added inside the code to understand the code in more detail.

Step 5: Adding the Required Permissions in the Manifest File 

Navigate to the app > AndroidManifest.xml file and add the below permissions to it. 

After adding these permissions to our AndroidManifest.xml file. Now run our app and see the output of the code. 

Output:

Comment
Article Tags:

Explore