Essential Android ADB shell edit forum

Send text key pressed and touch events to Android Device via ADB

execute the following command to insert the text into a view with a focus (if it supports text input)

Send text on SDK 23+

adb shell "input keyboard text 'Paste text on Android Device'"

If already connected to your device via adb:

input text 'Paste text on Android Device'

Send text prior to SDK 23

adb shell "input keyboard text 'Paste%stext%son%sAndroid%sDevice'"

Spaces are not accepted as the input, replace them with %s.

Send events

To simulate pressing the hardware power key

adb shell input keyevent 26

or alternatively

adb shell input keyevent POWER

Even if you don’t have a hardware key you still can use a keyevent to perform the equivalent action

adb shell input keyevent CAMERA

Send touch event as input

adb shell input tap Xpoint Ypoint

Send swipe event as input

adb shell input swipe Xpoint1 Ypoint1 Xpoint2 Ypoint2 [DURATION*]

*DURATION is optional, default=300ms. source

Get X and Y points by enabling pointer location in developer option.

ADB sample shell script

To run a script in Ubuntu, Create right click the file and add read/write permission and tick allow executing file as program.
Open terminal emulator and run the command ./

for (( c=1; c<=5; c++ ))
      adb shell input tap X Y
      echo "Clicked $c times"
      sleep 5s

For a comprehensive list of event numbers

Table Of Contents
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
229 ADB shell
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close