Last active
November 7, 2025 06:00
-
-
Save androidneha/896ec6b08137ef75a95341550b9c60fc to your computer and use it in GitHub Desktop.
Some adb commands to change setting for battery optimisation, start service, stop service, grant permission, revoke permission and etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To list-up installed app | |
| `pm list packages` | |
| # Search for a particualr app with pacakagename | |
| `pm list pacakges | grep com.abc` | |
| # Turn on Battery Optimization for a particular app | |
| `adb shell dumpsys deviceidle whitelist +<package_name>` | |
| # Turn off Battery Optimization for a particular app | |
| `adb shell dumpsys deviceidle whitelist -<package_name>` | |
| # To start a service | |
| `adb shell am startservice com.some.package.name/.YourServiceSubClassName` | |
| # To start a service | |
| `adb shell am stopservice com.some.package.name/.YourServiceSubClassName` | |
| # Grant Permission for ex WRITE_SECURE_STTINGS | |
| `adb shell pm grant com.abc.yourpackagename android.permission.WRITE_SECURE_SETTINGS` | |
| # Revoke Permission for ex WRITE_SECURE_STTINGS | |
| `adb shell pm revoke com.abc.yourpackagename android.permission.WRITE_SECURE_SETTINGS` |
You have the + and - the wrong way round for battery optimization; it is + to turn off battery optimization.
Indeed
Author
You have the + and - the wrong way round for battery optimization; it is + to turn off battery optimization.
Thanks
still there are six more typos, but thx it was what I was looking for ;)
adb shell settings put secure enabled_accessibility_services packagname/servicename
this will disable all the other accessibility services, you need to concat them with : (like with $PATH)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have the + and - the wrong way round for battery optimization; it is + to turn off battery optimization.