Android apps require certain permissions to function properly. While most Android apps ask for basic permissions, some may request higher-level permissions. We must review permission requests carefully before granting them because unnecessary permissions can compromise our privacy and security. We should question why an app needs particular permission and consider if it aligns with its functionality. This tutorial will explore various ADB commands to grant, revoke, and manage app permissions on Android devices.

It is essential to understand how permissions work and how they can impact your device. App permissions are categorized into different groups: ‘Normal’, ‘Dangerous’, and ‘Special’. Normal permissions do not risk your device’s security or privacy, while Dangerous and Special ones require explicit user approval before they can be granted. You can also use ADB Shell commands to print the list of all Android permissions.

adb shell pm list permissions -d -g

The above command will give a complete list of “dangerous group permissions” in the Terminal window. The following ADB command will fetch the list of permissions (allowed and not allowed) a specific app may request and whether or not the permission has been granted.

adb shell appops get <package-name>

show list of all permissions for a particular android app in adb

Table of Content

Granting App Permissions on Android

You can grant Android permissions from the Permission Manager in device Settings and from your computer using ADB. Below, we’ll check both.

Granting Permissions via Permission Manager

Keeping users’ privacy and security in view, Android lets us control app permissions. Here is how to allow permissions to apps on Android from Permission Manager.

  1. Open Settings on your Android device, navigate to Security and Privacy, and tap it.security and privacy settings android
  2. Look for the permission you want to grant to an app and select it.
  3. You’ll get the list of all apps using the specific permission.select app to grant android permissions
  4. Tap the app you wish to permit and select Allow or Allow only while using the app.allow permission to android app in permission manager

Steps to Grant Android Permissions Using ADB

With ADB commands, you have even more control over app permissions on your Android device without navigating through settings menus. Using ADB, you can grant app permissions individually and even in bulk. To be able to execute commands, you’ll have to set up the latest Android SDK tools on your computer and authorize ADB.

  1. Navigate to the ‘platform-tools‘ folder and launch a PowerShell window with its path.
  2. Go to Settings > Display on your device, extend the screen timeout to 5 minutes, and connect it to your PC via a USB cable.
  3. Now type the following command in PowerShell and press Enter to execute it. Allow USB debugging on your device when requested. You’ll get your device ID or serial number in the command window under the list of attached devices.
    adb devices

    adb devices command in windows powershell

  4. Next, execute the following command. You’ll see the codename of your Android device followed by a ‘$’ sign as shown below.
    adb shelladb shell command powershell
  5. You’ll see the codename of your Android device followed by a ‘$’ sign as shown in the screenshot above. Now, execute the following command after the ‘$’ sign in the given format to grant Android permission to an app.
    pm grant [package-name] [android-permission-name]
  6. Find the Android app package name you want to grant permission to.
  7. Now, execute the following command after the ‘$’ sign in the given format to grant Android permission to an app.
  8. For example, if you want to grant the Chrome browser permission to access your precise location, use the following command.
    pm grant com.android.chrome android.permission.ACCESS_FINE_LOCATION

    adb command to grant android permission

  9. That’s it. You’ve successfully granted Android permission using the ADB command.
5 Ways to Restore Deleted Contacts on Android

Revoking Android Permissions

Revoking permissions can be necessary for various reasons. It could be due to privacy concerns or app misbehavior. You can revoke app permissions on Android from Permission Manager in device settings. Since you can’t disable all permissions on your Android device via settings, you may need to use ADB commands in some cases.

Via Permission Manager

  1. Open Settings and go to Privacy and Security on your Android phone.
  2. Scroll to Permission Manager and open it.
  3. You’ll see the list of all Android permissions.
  4. Select the permission you want to revoke from an app.
  5. Tap the app and select Don’t allow to revoke a specific permission.revoke app permission from android permission manager

Revoke, Clear, and Reset Permissions via ADB

When you grant specific permissions to an app, they are stored on the system partition in a file called “packages.xml”. This file contains information about all the apps that have been granted specific permissions. When you revoke permissions through ADB, this file gets updated with the new permission status. Now, let’s dive into the steps for revoking individual, multiple, or all Android permissions via ADB.

Revoking a Single Permission

  1. Open a PowerShell window on your PC.
  2. Connect your Android device via a compatible USB cable and extend the screen timeout on your device so that the screen is not locked while executing ADB commands.
  3. Verify that ADB can detect your device by using the following command:
    adb devices
  4. Now execute the adb shell command.
  5. Type the following command right after the ‘$’ sign and press Enter.
    pm revoke [package-name] [android-permission-name]
  6. For example, if you want to revoke the camera permission from the Facebook app, use the above command.
    pm revoke com.facebook.katana android.permission.CAMERA

    revoke android permission for app via adb command

  7. The permission will be revoked from the Android app.

Revoking Multiple Permissions at Once

Here is how to use ADB to revoke multiple permissions from an Android app with a single command.

Open a PowerShell window and execute the following ADB command to revoke multiple Android permissions programmatically.

adb shell pm revoke [package-name] [android-permission name] [android-permission name]

Here is an example of revoking Camera and Contacts permissions from Facebook:

pm revoke com.facebook.katana android.permission.CAMERA android.permission.READ_CONTACTS

revoke multiple android permissions programmatically

Resetting and clearing All Permissions

Execute the following command in the PowerShell or Terminal window to clear app packages and thus revoke all their permissions at once.

adb shell pm clear [package-name]

System apps often come with pre-granted default permissions that cannot be revoked through regular means like disabling the app. To revoke these permissions, you can use the following command:

adb shell pm reset-permissions [package-name]

Thus, to clear all permissions from the Facebook app, use the command below. Do not forget to replace the package name with that of your app.

adb shell pm reset-permissions com.facebook.katana
adb shell pm clear com.facebook.katana

reset android permissions programmatically via adb

Granting and revoking permissions on Android devices can help you manage app access and protect your privacy and device security. I hope this tutorial helped you understand and manage Android permissions better.

Was this Article helpful?
YesNo