In this guide, we will cover up the most common and easy way for granting permissions over ADB (Android debug bridge). It will be long but it's because it includes detailed information and also screenshots so you can understand it better.
This example can be used with any other application, everything is the same except the package name. In this case, we'll use the Battery Guru app and platform tools for Windows.
This example can be used with any other application, everything is the same except the package name. In this case, we'll use the Battery Guru app and platform tools for Windows.
Things you need to have:
1. PC
2. USB Cable
3. And for sure Android device
1. PC
2. USB Cable
3. And for sure Android device
Step 1.
Download platform tools for your platform (Windows, Linux, or Mac) from the official Android developer site.
Android SDK Platform-Tools is a component for the Android SDK. It includes tools that interface with the Android platform, such as adb, fastboot, and systrace. These tools are required for Android app development. They're also needed if you want to unlock your device bootloader and flash it with a new system image.
Although some new features in these tools are available only for recent versions of Android, the tools are backward compatible, so you need only one version of the SDK Platform-Tools.
Download:
https://developer.android.com/studio/releases/platform-tools.html
Download platform tools for your platform (Windows, Linux, or Mac) from the official Android developer site.
Android SDK Platform-Tools is a component for the Android SDK. It includes tools that interface with the Android platform, such as adb, fastboot, and systrace. These tools are required for Android app development. They're also needed if you want to unlock your device bootloader and flash it with a new system image.
Although some new features in these tools are available only for recent versions of Android, the tools are backward compatible, so you need only one version of the SDK Platform-Tools.
Download:
https://developer.android.com/studio/releases/platform-tools.html
Step 2.
After downloading platform tools for your platform (Windows, Linux, or Mac), you are ready to extract the ZIP file. While doing this we need to prepare our Android device for the USB Debugging to connect it with ADB and grant necessary permissions.
After downloading platform tools for your platform (Windows, Linux, or Mac), you are ready to extract the ZIP file. While doing this we need to prepare our Android device for the USB Debugging to connect it with ADB and grant necessary permissions.
Step 3.
For this part of the guide, you need to perform several steps on your Android device. Steps with screenshots will be posted below. Every screenshot represents one step.
In this example, I'm using a Xiaomi device with MIUI, but steps are similar with any other OS (OneUI, AOSP, Oxygen...)
Steps to be done on your phone:
1. Open device settings, and select About.
2. Tap on Build number seven times, until it shows a message similar to one shown in the screenshot
3. Go back, and find Developer options.
4. Scroll down, and check the USB Debugging (some devices also have USB debugging (security settings), enable that also).
5. Plug your device into your computer if you aren't already."
6. Popup will appear on your device, you need to allow it. (Last screenshot)
For this part of the guide, you need to perform several steps on your Android device. Steps with screenshots will be posted below. Every screenshot represents one step.
In this example, I'm using a Xiaomi device with MIUI, but steps are similar with any other OS (OneUI, AOSP, Oxygen...)
Steps to be done on your phone:
1. Open device settings, and select About.
2. Tap on Build number seven times, until it shows a message similar to one shown in the screenshot
3. Go back, and find Developer options.
4. Scroll down, and check the USB Debugging (some devices also have USB debugging (security settings), enable that also).
5. Plug your device into your computer if you aren't already."
6. Popup will appear on your device, you need to allow it. (Last screenshot)
Step 4.
After successful setup and enabled USB debugging we are ready to use platform tools (downloaded in step 1.). We'll use Windows CMD to run the commands.
Steps to be done on your PC:
1. Hold Left Shift on keyboard and press right click on the opened folder and click on Open command window
2. After that run the command
- adb devices (press enter)
If the device is shown in the terminal window as shown in the screenshot, you have successfully connected the device.
3. Rewrite or copy the full command (this is an example of granting permission for BatteryGuru), repeat this step for each.
- adb shell pm grant com.paget96.batteryguru android.permission.DUMP (press enter)
After successful setup and enabled USB debugging we are ready to use platform tools (downloaded in step 1.). We'll use Windows CMD to run the commands.
Steps to be done on your PC:
1. Hold Left Shift on keyboard and press right click on the opened folder and click on Open command window
2. After that run the command
- adb devices (press enter)
If the device is shown in the terminal window as shown in the screenshot, you have successfully connected the device.
3. Rewrite or copy the full command (this is an example of granting permission for BatteryGuru), repeat this step for each.
- adb shell pm grant com.paget96.batteryguru android.permission.DUMP (press enter)
If for any reason your PC starts Power shell (just on Windows) instead of CMD, just follow next steps
1. Open Start and search for CMD (Command Prompt), run it as Administrator
2. Copy full path of your platform-tools directory
3. Go back to CMD and run command
- cd (paste full path of your platform-tools directory) (press enter)
4. Do the steps from previous screenshots
1. Open Start and search for CMD (Command Prompt), run it as Administrator
2. Copy full path of your platform-tools directory
3. Go back to CMD and run command
- cd (paste full path of your platform-tools directory) (press enter)
4. Do the steps from previous screenshots
After several tries, you'll definitely master the guide and you'll see it's actually pretty easy. This all can be done in approx. 3 minutes. Good luck :)