{"id":21997672,"url":"https://github.com/osfunapps/os_android_adb_handler-py","last_synced_at":"2025-07-06T15:03:50.999Z","repository":{"id":57449655,"uuid":"337004217","full_name":"osfunapps/os_android_adb_handler-py","owner":"osfunapps","description":"This repo aims to provide functional and simple ADB commands to control an Android device from code (externally).","archived":false,"fork":false,"pushed_at":"2021-02-08T08:23:21.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-06T04:09:41.838Z","etag":null,"topics":["adb","android","automation","osapps","osfunapps","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osfunapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-08T08:15:41.000Z","updated_at":"2025-06-28T21:27:10.000Z","dependencies_parsed_at":"2022-09-26T17:31:21.030Z","dependency_job_id":null,"html_url":"https://github.com/osfunapps/os_android_adb_handler-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/osfunapps/os_android_adb_handler-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos_android_adb_handler-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos_android_adb_handler-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos_android_adb_handler-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos_android_adb_handler-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osfunapps","download_url":"https://codeload.github.com/osfunapps/os_android_adb_handler-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos_android_adb_handler-py/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263922470,"owners_count":23530334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adb","android","automation","osapps","osfunapps","python"],"created_at":"2024-11-29T22:17:37.624Z","updated_at":"2025-07-06T15:03:50.981Z","avatar_url":"https://github.com/osfunapps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n------------\n\nThis module aims to provide functional and simple ADB commands to control an Android device from code (externally).\n\n## Installation\nInstall via pip:\n\n```python \npip install os-android-adb-handler\n```\n\n# Usage and examples:       \n* Make sure you have [adb](https://developer.android.com/studio/command-line/adb) installed and an Android device connected.   \n\nThen just import the module and use it like so:\n\n```python\nfrom os_android_adb_handler import adb_handler\n\n# install an apk\nadb_handler.install_apk(apk_path='path/to/apk/file.apk')\n\n# start an app\nadb_handler.start_app(package_name='com.osapps.pacakge', path_to_first_activity='startup.MainActivity')\n\n# wait a bit for the app execution\ntime.sleep(7)\n\n# go right\nadb_handler.dpad_right()\n\n# go up\nadb_handler.dpad_up()\n\n# take a screen shot\nadb_handler.take_ss('path/to/ss1.png')\n\n# go right\nadb_handler.dpad_right()\n\n# click enter\nadb_handler.enter()\n\n# take another ss\nadb_handler.take_ss('path/to/second/ss2.png')\n\n# send a shell command\nadb_handler.send_shell(command='run something')\n\n# send a custom key events\nfrom os_android_adb_handler import key_events\nadb_handler.key_event(key_events.KEYCODE_F)\nadb_handler.key_event(key_events.KEYCODE_U)\nadb_handler.key_event(key_events.KEYCODE_C)\nadb_handler.key_event(key_events.KEYCODE_K)\nadb_handler.key_event(key_events.KEYCODE_DEL)\n\n# remove an app\nadb_handler.uninstall_app(package_name='com.osapps.pacakge')\n```\n\n## Function signatures\n```python\ndef start_app(package_name, path_to_first_activity):\n    \"\"\"\n    Will start an already installed App in the device.\n\n    Args:\n        package_name: The app's package name\n        path_to_first_activity: The relative path to the first activity (like main.MainActivity)\n    \"\"\"\n\ndef take_ss(ss_file_path):\n    \"\"\"\n    Will take a screen shot.\n\n    Args:\n        ss_file_path: The destination path of the screen shot (file name, incl extension)\n    \"\"\"\n\ndef install_apk(apk_path):\n    \"\"\"\n    Will install an APK file.\n\n    Args:\n        apk_path: The path to your APK file.\n    \"\"\"\n\ndef uninstall_app(package_name):\n    \"\"\"\n    Will uninstall an app.\n\n    Args:\n        package_name: The app's package name\n    \"\"\"\n\ndef go_back():\n    \"\"\"\n    Will navigate back\n    \"\"\"\n\ndef enter():\n    \"\"\"\n    Will click the Enter key\n    \"\"\"\n\ndef dpad_right():\n    \"\"\"\n    Will click the Right key\n    \"\"\"\n\ndef dpad_left():\n    \"\"\"\n    Will click the Left key\n    \"\"\"\n\ndef dpad_up():\n    \"\"\"\n    Will click the Up key\n    \"\"\"\n\ndef dpad_down():\n    \"\"\"\n    Will click the Down key\n    \"\"\"\n\ndef key_event(key):\n    \"\"\"\n    Will send a key event.\n    \n    Args:\n        key: The key you want to send. You can use of the key_events keys\n    \"\"\"\n\ndef send_input(event):\n    \"\"\"\n    Will send an input event\n    \"\"\"\n\ndef send_shell(command):\n    \"\"\"\n    Will send a shell command\n    \"\"\"\n\ndef adb(command):\n    \"\"\"\n    Will send an adb command\n    \"\"\"\n\n.....\n```\n\n## Licence\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fos_android_adb_handler-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosfunapps%2Fos_android_adb_handler-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fos_android_adb_handler-py/lists"}