How to Grant Permissions Using ADB in Android via Windows 10 — The majority of Android apps can easily request basic permissions such as storage or camera access. Some apps, on the other hand, require system-level permissions to function properly.
While you can get around this by rooting your phone, it’s a time-consuming and sometimes unnecessary process. Instead, you can use ABD commands to grant advanced permissions.
In this article, we’ll define ADB and show you how to use it to grant permissions on Android.
What Is Android Debug Bridge (ADB)?
In Android, ordinary users are frequently unable to perform system-protected tasks such as removing unwanted pre-installed apps without the use of advanced techniques such as rooting. ADB (Android Debug Bridge) comes in handy here.
ADB commands can be used to uninstall system apps, install APK files, collect system logs, grant additional permissions to apps, and more.
Granting Permissions Over ADB
Before you can use the commands, you must first establish an ADB connection with your device. Let’s use Windows as the ADB commands in this context.
PowerShell will be used by Windows users to execute the ADB commands.
- Get the SDK Tool.
Download the SDK Platform-Tools file for your operating system from the Android Developers website.
- Unzip the ZIP file
Navigate to the location where you saved the ZIP file. Now, extract the ZIP file and open the platform-tools folder (do not double-click it).
- Launch PowerShell or Terminal.
Hold down Alt and then press F, S, and A. (one key at a time, sequentially). This combination of keys will launch PowerShell as an administrator.
- Turn on Developer Options
If you haven’t already, enable Developer Options on your smartphone. Go to Settings > About phone and tap on the Build number to do so (seven times).
If you are prompted for a password, enter your lock screen password.
- Enable USB Debugging and Plug in Your Phone
Go to Developer Options and turn on USB debugging. If prompted by a pop-up, click OK. Finally, use a USB cable to connect your phone to your computer.
- Validate the Device Connection
To verify that your device is successfully connected, run the following command in PowerShell or Terminal:
If you are unable to see your device’s unique serial number after entering the above command, it indicates that something is wrong on your end. This occurs primarily when your PC is unable to detect the ADB drivers on your device.
Download and install the universal drivers from the ClockworkMod website or the latest version ADB installer from this XDA forum post to resolve this issue.
- Enable USB Debugging
If you’re using ADB commands for the first time, a popup will appear on your phone after step six, asking if you want to Allow USB debugging. Select the Always allow from this computer checkbox and tap Allow.
- Type in the ADB Commands
Now, in PowerShell or Terminal, enter the following command:
Finally, you can use this command to grant permissions to any app using ADB:
pm grant<package-name> <permission>
<package-name>with the app’s package name and with the required permission. If you can’t find the package name, download Package Name Viewer 2.0 and look for the app that requires advanced permission. In this case, we will grant permission to the Battery Guru app.
As shown below, the package name is com.paget96.batteryguru, and the permission is Android.permission. The permission is PACKAGE USAGE STATS. This locates the BatteryGuru app and allows you to view usage and statistics.
pm grant com.paget96.batteryguru android.permission.PACKAGE_USAGE_STATS
Without a doubt, ADB is a fantastic tool for a variety of purposes. It not only allows you to grant app permissions, but it also allows you to back up your system data without requiring root access.
Once you’ve delved into the power of ADB, you’ll begin to understand and appreciate the Android environment’s versatility.