如何使用ADB将一些文本复制到android系统剪贴板? [英] How to copy some text to android system clipboard using ADB?

查看:2631
本文介绍了如何使用ADB将一些文本复制到android系统剪贴板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自动化我扎根的android Oreo上的某些内容,但似乎找不到找到将某些文本复制到剪贴板的方法。我可以粘贴复制的文本 adb shell输入keyevent 279 ,以便希望也能获得一些复制文本的方法。

I want to automate some stuff on my rooted android Oreo and can't seem to find a way to copy some text to clipboard. I can paste the copied text adb shell input keyevent 279 so hoping to get some way to copy text also.

PS:没有寻找暗示 adb shell输入文本[text] 的答案,这很慢。

P.S: not looking for answers suggesting adb shell input text [text] cause it's slow.

推荐答案

似乎有2种方法可以使用 adb shell 将文本复制到android剪贴板中。

It seems there are 2 ways to copy a text into android clipboard using adb shell.


  1. 使用服务呼叫剪贴板2 i32 1 i32 0 s16文本 (已弃用,并且无法在android 8上运行)

  2. 使用外部服务,并将其文本通过意向附加功能传递给它。它接收文本,然后尝试将其复制到剪贴板。例如,我们可以在设备上安装 Clipper ,然后运行 am broadcast -a clipper .set -e文本文本 adb shell 中。

  1. Using service call clipboard 2 i32 1 i32 0 s16 "text" (Deprecated and doesn't work on android 8)
  2. Using an external service and pass it the text through intent extras. It receives the text then tries to copy it into the clipboard. For example we can install Clipper on the device then run am broadcast -a clipper.set -e text "text" in adb shell.

这篇关于如何使用ADB将一些文本复制到android系统剪贴板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆