https://github.com/therealone78/pybattery
A python script changing Android battery level with adb, alternating between 2% and 1000%
https://github.com/therealone78/pybattery
adb android pybattery
Last synced: about 2 months ago
JSON representation
A python script changing Android battery level with adb, alternating between 2% and 1000%
- Host: GitHub
- URL: https://github.com/therealone78/pybattery
- Owner: TheRealOne78
- License: gpl-3.0
- Created: 2021-05-11T08:10:08.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T12:24:41.000Z (over 2 years ago)
- Last Synced: 2025-07-01T09:44:36.098Z (12 months ago)
- Topics: adb, android, pybattery
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyBattery
A Python-based application that will change android device battery level, looping from 2% to 1000% and viceversa.
### Dependencies
#### [adb - Android Debug Bridge](https://developer.android.com/tools/adb)
In **GNU/Linux** distributions, install `adb` on:
- **Debian** based distros with `(sudo) apt install adb android-sdk-platform-tools-common`
- **Arch** based distros with `(sudo/doas) pacman -S android-tools`
- **Gentoo** with `(sudo/doas) emerge dev-util/android-sdk-update-manager`
In **Apple macOS**, install `adb` by:
- Installing with [homebrew](https://brew.sh), using `brew install android-platform-tools`
- Or by manually installing it from https://developer.android.com/tools/adb
In **Microsoft Windows**, install `adb` from [https://developer.android.com/tools/adb](https://developer.android.com/tools/adb).
#### [Python](https://www.python.org/)
In **GNU/Linux** distributions, install `python` on:
- **Debian** based distros with `[sudo] apt install python3`
- **Arch** based distros with `[sudo/doas] pacman -S python`
- **Gentoo** with `[sudo/doas] emerge -a dev-lang/python`
In **Apple macOS**, install `python` from [https://www.python.org/downloads](https://www.python.org/downloads).
In **Microsoft Windows**, install `python` from [https://www.python.org/downloads](https://www.python.org/downloads).
### Download
There are 3 main methods to download the source code:
1. By downloading the git repository by cloning it with `git clone https://github.com/TheRealOne78/pybattery.git`;
2. By downloading a zip file from https://github.com/TheRealOne78/pybattery/archive/refs/heads/main.zip or clicking the `Code`>`Download ZIP` buttons in GitHub;
3. Or by copying/downloading the source code from https://github.com/TheRealOne78/pybattery/blob/main/pybattery.py or clicking the `pybattery.py` file in GitHub and copying/downloading the source code.
### How to run
In the Android device, `USB Debbuging` in Developer Options needs to be activated in order for `adb` to reach and send commands to the Android device.
In **Linux** and **macOS** run the python file with `python3 ./pybattery.py`.
In Windows double click pybattery.py to execute it via python.
For restoring the battery level to normal, `adb shell dumpsys battery reset` needs to be executed or Android has to be rebooted.
### Disclaimer and License
Copyright (C) 2023 TheRealOne78
License GPLv3+: GNU GPL version 3 or later [https://gnu.org/licenses/gpl.html](https://gnu.org/licenses/gpl.html).
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
**I am not responsible for any damage to your devices. Experiment at your own risk!**