Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paste text on Android using ADB?

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

like image 705
Dysanix Official Avatar asked May 11 '16 21:05

Dysanix Official


People also ask

How do I copy and paste in ADB?

As you would just "CTRL+V" on windows, I just need to "CTRL+V" on Android if you know what I mean. Not directly through adb. If you have root, you could create a background system service that responds to an intent, and upon receiving the intent, inject a key sequence equivalent to paste (Ctrl + V).


1 Answers

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
like image 154
Laraconda Avatar answered Sep 24 '22 21:09

Laraconda