ADB: Input text from terminal

You can input text to your Android emulator (or physical device) using adb from terminal with adb shell input text "enterTextHere".

That's a bit too long, so here's a function for you:

// .zshrc
aw() {
   adb shell input text "$*"

And just call it with aw myUserName

Note that instead of spaces you need to write %s for adb to understand, so multiple word sentences look like aw multiple%sword%ssentece

One could change that script to insert %s between every argument but I couldn't do that from top of my head, and not it's that relevant for me.

✌🏼 Like my content? Subscribe via RSS feed.