Giter Site home page Giter Site logo

adbkeyboard's Introduction

ADBKeyBoard

Android Virtual Keyboard Input via ADB

ADBKeyBoard is a virtual keyboard that receives commands from system broadcast intents, which you can send text input using adb.

There is a shell command 'input', which can help you send text input to the Android system.

usage: input [text|keyevent]
  input text 
  input keyevent 

But you cannot send unicode characters using this command, as it is not designed to use it this way.
Reference : http://stackoverflow.com/questions/14224549/adb-shell-input-unicode-character

e.g.
adb shell input text '你好嗎' 
is not going to work.

ADBKeyboard will help in these cases, especially in device automation and testings.

Build and install APK

With one device or emulator connected, use these simple steps to install the keyboard:

  • Get source: git clone https://github.com/senzhk/ADBKeyBoard.git
  • Go into project dir cd ADBKeyBoard
  • Set Android SDK location: export ANDROID_HOME=$HOME/Android/Sdk or edit file local.properties
  • Build and install: ./gradlew installDebug

How to Use

  • Enable 'ADBKeyBoard' in the Language&Input Settings.
  • Set it as Default Keyboard OR Select it as the current input method of certain EditText view.
  • Sending Broadcast intent via Adb or your Android Services/Apps.

Usage Example:

1. Sending text input
adb shell am broadcast -a ADB_INPUT_TEXT --es msg '你好嗎? Hello?'

2. Sending keyevent code  (67 = KEYCODE_DEL)
adb shell am broadcast -a ADB_INPUT_CODE --ei code 67

3. Sending editor action (2 = IME_ACTION_GO)
adb shell am broadcast -a ADB_EDITOR_CODE --ei code 2

4. Sending unicode characters
To send 😸 Cat
adb shell am broadcast -a ADB_INPUT_CHARS --eia chars '128568,32,67,97,116'

Switch to ADBKeyBoard from adb (by robertio) :

adb shell ime set com.android.adbkeyboard/.AdbIME   

Switch back to original virtual keyboard: (swype in my case...)

adb shell ime set com.nuance.swype.dtc/com.nuance.swype.input.IME  

Check your available virtual keyboards:

adb shell ime list -a  

You can try the apk with my debug build: https://github.com/senzhk/ADBKeyBoard/blob/master/bin/ADBKeyBoard.apk

KeyEvent Code Ref: http://developer.android.com/reference/android/view/KeyEvent.html

Editor Action Code Ref: http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html

adbkeyboard's People

Contributors

andrewleo avatar senzhk avatar webmaster128 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.