Skip to content

Add support for PyBox android#293

Open
m-anshuman2166 wants to merge 1 commit intoasweigart:masterfrom
m-anshuman2166:patch-1
Open

Add support for PyBox android#293
m-anshuman2166 wants to merge 1 commit intoasweigart:masterfrom
m-anshuman2166:patch-1

Conversation

@m-anshuman2166
Copy link
Copy Markdown

@m-anshuman2166 m-anshuman2166 commented Mar 7, 2026

Add Android (PyBox) clipboard support to pyperclip

This PR adds native clipboard support for Android devices running the PyBox Python environment.

Changes

  • Added init_android_pybox_clipboard() - implements copy and paste using PyBox's ClipboardReceiver broadcast API
  • Added PyBox detection in determine_clipboard() - checks for Android platform and com.vytros.pybox in sys.executable

How it works

On Android, standard clipboard mechanisms like xclip, pbcopy, or Windows clipboard APIs are unavailable. PyBox exposes a BroadcastReceiver that handles clipboard get/set operations. pyperclip communicates with it via am broadcast with the required --user 0, stderr=stdout and stdin=DEVNULL flags to bypass Android SELinux restrictions on untrusted app processes.

Testing

  • Tested on Android 8.0 to 16 inside PyBox environment
  • pyperclip.copy() and pyperclip.paste() both working as expected

Demo

Screen_recording_20260307_153144.mp4

Note

The PyBox Project not yet public, but is scheduled to launch within next few months. Since pyperclip is a part of our templates, we require support out of the box.

This implementation has been tested from Android 8.0 to Android 16

Regards

@m-anshuman2166
Copy link
Copy Markdown
Author

Further clarifying on PyBox - It is a python learning and development environment for android which is nearing its release within next few months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant