Easy Technology Tips, Tricks & Guides

How to Grant Permissions Using ADB in Android

Most Android apps can easily ask for basic permissions like storage or camera access. However, some apps require system-level permissions to function properly.

While you can overcome this by rooting your phone, that’s a complicated and sometimes unnecessary process. Instead, you can grant advanced permissions using ABD commands.

In this article, we’re going to explain what ADB is and how to use it to grant permissions on Android.

What Is Android Debug Bridge (ADB)?

In Android, normal users often can’t perform system-protected tasks such as removing unwanted pre-installed apps without advanced techniques, like altering the operating system files through rooting. This is where ADB (Android Debug Bridge) comes in.

ADB is a command-line tool by which you can connect an Android device to a computer to perform those tasks that require root.

Related: Practical ADB Commands Every Android User Should Know

You can use various useful ADB commands to uninstall system apps, install APK files, take system logs, grant additional permissions to apps, and more.

How to Grant Permissions Over ADB

Before using the commands, you need to set up an ADB connection with your device. Using Windows, Mac, or Linux has almost no difference, as the ADB commands are the same for all operating systems.

However, Windows users will use PowerShell, while Mac and Linux users need to use a terminal or shell to execute the ADB commands.


1. Download the SDK Tool

Android Developers Website

Visit the Android Developers website and download the SDK Platform-Tools file for your operating system.

This step is only for Windows users; if you use Mac or Linux, proceed to the next step.

Platform Tools Folder In Windows

If you’re a Windows user, browse to the location where you downloaded the ZIP file. Now, extract the ZIP and click the platform-tools folder once (don’t double-click the folder).

3. Open PowerShell or the Terminal

If you’re on Windows, hold Alt and press F, S, then A (one key at a time, sequentially). This key combination will open PowerShell as an administrator.

If you’re on Linux or Mac, you have to open a Terminal in the same folder where the contents of the platform-tools folder are stored.

4. Enable Developer Options

Now, you need to enable Developer Options on your smartphone, if it isn’t already. To do so, go to Settings > About phone and tap on the Build number (seven times).

If it asks for a password, enter your lock screen password.

5. Enable USB Debugging and Connect Your Phone

Now, go to Developer Options and enable USB debugging. Press OK if prompted by a pop-up. Finally, connect your phone to your computer using a USB cable.

6. Confirm the Device Connection

Type the command below in PowerShell or Terminal to check your device is successfully connected:

.adb devices
Adb Devices Command In PowerShell

If you cannot see your device’s unique serial number after entering the above command, it means something is wrong from your side. This happens mainly when your PC can’t detect the ADB drivers on your device.

To fix this issue, download and install the universal drivers from the ClockworkMod website or download the latest version ADB installer from this XDA forum post.

If your issue persists, follow the steps in our guide to fixing ADB connection issues in Windows.

7. Allow USB Debugging

If you’re using ADB commands for the first time, after step six, a popup will appear on your phone to ask if you want to Allow USB debugging. Select the checkbox that says Always allow from this computer and tap Allow.

8. Enter the ADB Commands

Now, type the following command in PowerShell or Terminal:

.adb shell
Adb Shell Command In PowerShell

Finally, you can use this command to grant permissions to any app using ADB:

pm grant <package-name> <permission>

Replace <package-name> with the app’s package name and <permission> with the required permission. If you cannot locate the package name, you can download Package Name Viewer 2.0 and search for the app that needs advanced permission. In our case, we are going to grant permission to the Battery Guru app.

For example, as you can see below, com.paget96.batteryguru is the package name and Android.permission.PACKAGE_USAGE_STATS is the permission. This searches for the BatteryGuru app and grants access to see usage and statistics.

pm grant com.paget96.batteryguru android.permission.PACKAGE_USAGE_STATS
Permission Via Adb Command

As another example, if you want to use Naptime without rooting your phone, you can enter the following commands to grant the required permissions:

pm grant com.franco.doze android.permission.DUMP
pm grant com.franco.doze android.permission.WRITE_SECURE_SETTINGS

Get More Control Over Android With ADB

No doubt, ADB is a great tool for a host of helpful things. Not only does it help you grant app permissions, but you can also back up your system data without root.

Once you delve into the power of ADB, you’ll begin to understand and enjoy the versatility of the Android environment.

6 Android ADB Apps for Powerful Features Without Root

Want to get more control over your Android device? Try these apps that let you use ADB functionality without rooting.

Read Next

About The Author


>>Here is the Original Post!

Leave A Reply

Your email address will not be published.