问题
This might seem like a duplicate question, but hear me out.
I basically need to press "CTRL+V" inside of Android. I need to paste the current Android clipboard into the focused TextBox.
So this:
adb shell input text [text]
won't do, as it requires me to enter the text myself. I just need to paste the current clipboard.
Is that possible through ABD? I googled and googled and all I found was ways to set clipboard content and not actually just press the paste button.
for the sake to ease development
回答1:
Since API 24, KEYCODE_PASTE
is available from the KeyEvent
class, its constant is 279
.
The adb command would be as follows:
adb shell input keyevent 279
回答2:
My solution:
- I installed the Tasker plugin.
- I made a "scene" with a button.
- On the button tap event I added the "Control+V plugin" with the configuration to type
%CLIP
. - Now I made a profile that direct to a task to show the scene (overlay,blocking).
- And last but not least, I use
adb shell input tap x y
to tap the button.
来源:https://stackoverflow.com/questions/37173733/paste-text-on-android-using-adb