Skip to main content

handles spaces, accents and other sneaky characters in ADB commands

Tested against Windows / Python 3.11 / Anaconda

pip install adbeasykey

from adbeasykey import AdbEasyKey
adbpath = r"C:\Android\android-sdk\platform-tools\adb.exe"
serial_number = "127.0.0.1:5555"
adb = AdbEasyKey(adbpath, serial_number, use_busybox=False) # if use_busybox is True, busybox will be used to decode the base64-encoded command
adb.connect_to_device_ps()
adb.connect_to_device_subprocess()
text = f'"it\'s me", he said then he went away "Montréal, über, 12.89, Mère, Françoise, noël, 889 groß"""'
adb.install_adb_keyboard()
adb.input_text_adb_keyboard_ps(
    text, change_back=True, sleeptime=(0, 0), add_exit=True
)  # preserves accents - suffix _ps is for use Windows Powershell
adb.input_text_adb_keyboard_subprocess(
    text, change_back=True, sleeptime=(0.1, 0.2), add_exit=True
)  # preserves accents
adb.keyevents.KEYCODE_A.press_ps()
adb.keyevents.KEYCODE_A.press_subproc()
adb.keyevents.KEYCODE_A.longpress_subproc()
adb.keyevents.KEYCODE_A.longpress_ps()
adb.input_text_ps(text)  # doesn't preserve accents
adb.input_text_ps(text, remove_accents=True)  # ç -> c
adb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True) # one by one
adb.input_text_ps(text, sleeptime=(0.1, 0.2), remove_accents=True, input_device='keyboard') 
adb.keyevents.KEYCODE_A.longpress_ps.gamepad()
adb.keyevents.KEYCODE_A.longpress_ps.keyboard()
adb.input_text_subprocess(text)  # doesn't preserve accents
adb.input_text_subprocess(text, remove_accents=True)  # ç -> c
adb.input_text_subprocess(text, sleeptime=(0.1, 0.2), remove_accents=True)
stdout, stderr = adb.adb_shell_ps("ls / -1 -R -i -H -las")
stdout, stderr = adb.adb_shell_ps("ls /data")  # no permission
stdout, stderr = adb.adb_shell_ps("ls /data", su=True)  # permission
stdout, stderr = adb.adb_shell_ps('mkdir "/sdcard/bub ö äß"')
stdout, stderr = adb.adb_shell_ps("ls /sdcard/")
stdout, stderr = adb.adb_shell_subprocess("ls / -1 -R -i -H -las")
stdout, stderr = adb.adb_shell_subprocess("ls /data")  # no permission
stdout, stderr = adb.adb_shell_subprocess("ls /data", su=True)  # permission
stdout, stderr = adb.adb_shell_subprocess('mkdir "/sdcard/#gx bub ö äß"')
stdout, stderr = adb.adb_shell_subprocess("ls /sdcard/")
stdout, stderr = adb.adb_ps(
    cmd=r"push C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf"
)
stdout, stderr = adb.adb_subprocess(
    cmd=r"push C:\Users\hansc\Downloads\Roger LeRoy Miller, Daniel K. Benjamin, Douglass C. North - The Economics of Public Issues-Pearson College Div (2017).pdf /sdcard/Download/testbba.pdf"
)

stdout, stderr = adb.adb_shell_ps(
    "input swipe 600 600 0 0 1000\ninput swipe 0 0 600 600 1000",
)
adb.is_keyboard_shown()
adb.get_active_keyboard()
adb.change_to_adb_keyboard()
adb.change_keyboard(
    keyboard="com.android.inputmethod.latin/.LatinIME",
)

Metadata

Release files for adbeasykey 0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adbeasykey 0.12
File Size Uploaded Provenance Actions
adbeasykey-0.12.tar.gz 26.6 kB Without provenance Details for adbeasykey-0.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adbeasykey 0.12
File Interpreter ABI Platform Actions
adbeasykey-0.12-py3-none-any.whl Python 3 none any Details for adbeasykey-0.12-py3-none-any.whl

Total release size: 53.6 kB

Release files / adbeasykey-0.12.tar.gz

Download URL adbeasykey-0.12.tar.gz
Size 26.6 kB
Tags Source
SHA-256 checksum
How to use checksums
520011ca77cb8e0d3f1f074b1497d69a1aef8056d85085b7daa8d9ab7acf7dff
BLAKE2b-256 checksum
How to use checksums
54bf6f3e92c78e38df7298ee0c418787aedf317303e3bf7d705d165aa42c10d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / adbeasykey-0.12-py3-none-any.whl

Download URL adbeasykey-0.12-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02cd86e82b0e89f6fbbe566dfeccc0f30f90599258c4d80420e6adfc7afd77c1
BLAKE2b-256 checksum
How to use checksums
c14d7f2715d7db77e51c6ff6ae562f22401397fafdffc161782f9a9c4b3f82b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for adbeasykey 0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.12 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page