Sometimes an app asks for a permission you don’t want to grant, or you need to give a permission that the UI hides behind a prompt you can’t see (e.g., after a silent install). Android’s pm tool, reachable through ADB, lets you control runtime permissions directly from your computer – no root required.
All commands below assume you have a working ADB installation on a Windows, macOS, or Linux PC and that USB debugging is enabled on the phone.
platform-tools folder.adb devices. You should see a line with your device serial number and the word device.
adb devices
List of devices attached
ABCD12345678 device
unauthorized, check the phone for the RSA dialog and tap "Allow".id=, e.g., com.whatsapp.adb shell pm list packages | grep -i "keyword"
Replace keyword with part of the app name.
PACKAGE_NAME with the actual name:
adb shell pm dump PACKAGE_NAME | grep "android.permission"
adb shell dumpsys package PACKAGE_NAME | grep granted=true
granted=true or granted=false.android.permission.ACCESS_FINE_LOCATION.adb shell pm grant PACKAGE_NAME android.permission.ACCESS_FINE_LOCATION
granted=true.android.permission.READ_CONTACTS.adb shell pm revoke PACKAGE_NAME android.permission.READ_CONTACTS
granted=false.While ADB does not accept a list in a single call, you can script the process. Below is a one‑liner for Linux/macOS; Windows users can copy the lines into a .bat file.
# Grant location and camera
for perm in android.permission.ACCESS_FINE_LOCATION android.permission.CAMERA; do
adb shell pm grant com.example.app $perm
done
# Revoke contacts and microphone
for perm in android.permission.READ_CONTACTS android.permission.RECORD_AUDIO; do
adb shell pm revoke com.example.app $perm
done
Since Android 6.0 (Marshmallow) the system separates dangerous permissions from normal ones. The UI asks the user at runtime, but the underlying package manager (the pm tool) still controls the grant state. ADB runs with the android.permission.GRANT_RUNTIME_PERMISSIONS privilege, which is granted to the shell user on every device – that’s why root is not required.
appops for finer controlSome permissions are mapped to app ops (e.g., android:access_fine_location maps to android:location_fine). If you need to toggle an operation without changing the formal permission, use:
adb shell appops set PACKAGE_NAME OPERATION MODE
Common values for MODE are allow, ignore, and deny. Example:
adb shell appops set com.example.app ACCESS_FINE_LOCATION ignore
This can be useful when an app declares a permission but you only want to block the underlying operation.
adb devices – try a different USB cable, enable "USB debugging (Security settings)" if available, or restart the ADB server with adb kill-server && adb start-server.Granting dangerous permissions (location, microphone, contacts, etc.) gives the app full access to that data. Only grant permissions to apps you trust.
Revoking a permission that an app relies on for core functionality may render the app unusable until the permission is restored.
Using ADB to manage runtime permissions gives you granular control without rooting or reinstalling apps. The workflow – connect, identify the package, list current grants, then pm grant or pm revoke – can be repeated for any app on any Android device that supports the standard ADB shell user.
Keep this guide handy whenever you encounter a permission prompt you can’t dismiss, want to pre‑grant a permission for an automated test, or need to lock down an app after a security audit. With a few typed commands you’ll have the same power as the system UI, but with the precision of a terminal.









