From ebf9fef4cd2c95affaaa1091181ccb7b08fdcb50 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Tue, 5 Aug 2025 09:15:00 +0300 Subject: [PATCH] Update readme and check build versions --- README.md | 62 ++++++++++++++++++++++++++++-- android_manager/android_manager.py | 7 +++- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3cc7e86..5495d21 100755 --- a/README.md +++ b/README.md @@ -1,17 +1,37 @@ # android_manager +Do backups and restores of apps installed in your Android phone via the Android USB Debug + ## Requirements +1. Enable Android USB debug. + + 1. In your Android phone, go to Settings + + 2. Go to "About phone" + + 3. Click repeatedly over "Build number", you might get ask for confirmation with your security protection (pin, password, fingerprint, face, ...) + + 4. Go to "System" + + 5. Go to "Developer options" + + 6. Enable "USB debbuging" + +2. Connect your phone via USB to your computer + ## Installation ### Linux To install for example in your ~/.local/bin folder: + ```bash ./install.sh --destination ~/.local/bin ``` To install system-wide: + ```bash sudo ./install.sh --destination /usr/local/bin ``` @@ -23,11 +43,47 @@ Change your configuration file in "${HOME}/.config/android_manager.conf" (see th Ensure you have "C:\Users\${env:USERNAME}\AppData\Roaming\Python\Python${python_version}\Scripts\" in your Path environment variable. ```powershell -& $(where.exe pip).split()[0] install . + & $(where.exe pip).split()[0] install . ``` ## Usage - ```bash -android_manager.sh [--debug-level|-d CRITICAL|ERROR|WARNING|INFO|DEBUG|NOTSET] # Other parameters +```bash +android_manager.py [OPTIONS] COMMAND [ARGS] ``` + +### General options +|short|long|parameter|description| +|--|--|--|--| +|-d| --debug-level|[critical|error|warning|info|debug|notset] |Set the debug level for the standard output.| +|-l| --log-file|TEXT |File to store all debug messages.| +|-f| --cache-file|TEXT |Cache file to store data from each run| +|-a| --max-cache-age|INTEGER |Max age in seconds for the cache| +|-H| --host|TEXT |ADB server host name or IP.| +|-p| --port|INTEGER |ADB server port to use.| +||--config|FILE |Read configuration from FILE.| +||--help|| |Show this message and exit.| +--- +### Commands + +#### Backup Android apps: backup-apps + +##### Backup apps options + +|short|long|parameter|description| +|--|--|--|--| +|-p|--backup-path|TEXT| Path to save the backed APKs [required]| +|-n|--just-names|| Save only the filename| +||--config| FILE| Read configuration from FILE.| +||--help|| Show this message and exit.| + +#### Restore Android apps: restore-apps + +##### Restore apps options + +|short|long|parameter|description| +|--|--|--|--| +|-p|--backup-text-file |TEXT| Path to save the backed APKs [required]| +|-n|--device-product-name| TEXT| Device product name to install the apps. If not indicated it will install in the first device found.| +||--config| FILE | Read configuration from FILE.| +||--help|| Show this message and exit.| diff --git a/android_manager/android_manager.py b/android_manager/android_manager.py index 047621f..97f79ca 100755 --- a/android_manager/android_manager.py +++ b/android_manager/android_manager.py @@ -150,7 +150,12 @@ class AndroidManager: continue for build in app_data['Builds']: if build['versionCode'] > latest_build: - latest_build = build['versionCode'] + build_url = f"https://verification.f-droid.org/{app_code}_{build['versionCode']}.apk.json" + result = session.get( + build_url + ) + if result.status_code < 400: + latest_build = build['versionCode'] if latest_build == 0: self._log.error( "Unable to find the latest version code in the app data file '%s'",