Giter VIP home page Giter VIP logo

android-unicode's Introduction

android-unicode

NPM version build status Test coverage node version npm download

Android unicode UTF-7 input apk

Android Unicode Input Service Node.js wrapper.

Installment

$ npm i android-unicode --save

Use in ADB shell

Ref: https://github.com/senzhk/ADBKeyBoard

  1. Sending text input
$ adb shell am broadcast -a ADB_INPUT_TEXT --es msg '你好Hello'
$ adb shell am broadcast -a ADB_INPUT_TEXT --es format base64 --es msg 'K1RpMWxody1jbg=='

K1RpMWxody1jbg== is encode with UTF-7 and Base64

Use python code like this.

import base64

s = u'你好''
print base64.b64encode(s.encode("utf-7"))
  1. Sending keyevent code (67 = KEYCODE_DEL)
$ adb shell am broadcast -a ADB_INPUT_CODE --ei code 67
# repeat 10 times
$ adb shell am broadcast -a ADB_INPUT_CODE --ei code 67 --ei repeat 10
  1. Sending editor action (2 = IME_ACTION_GO)
$ adb shell am broadcast -a ADB_EDITOR_CODE --ei code 2
  1. Sending unicode characters
# To send 😸 Cat
$ adb shell am broadcast -a ADB_INPUT_CHARS --eia chars '128568,32,67,97,116'

Usage

Switch to Utf7ImeService

$ adb shell ime set macaca.unicode.ime/.Utf7ImeService

Switch to system default Service

$ adb shell ime set com.android.inputmethod.pinyin/.PinyinIME

List available Service

$ adb shell ime list -a

License

The MIT License (MIT)

android-unicode's People

Contributors

codeskyblue avatar xudafeng avatar zhong914 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-unicode's Issues

Failed to npm install android-unicode --save

sudo npm i macaca-android --save

[email protected] install /Users/admin/node_modules/android-unicode
node ./script/build.js

Error: $JAVA_HOME is not set
at checkJavaHome.then.catch.then.then.catch.then.std (/Users/admin/node_modules/java-home/lib/java-home.js:89:25)
at process._tickCallback (internal/process/next_tick.js:103:7)
/Users/admin/node_modules/android-unicode/script/build.js:15
throw e;
^

Error: $JAVA_HOME is not set
at checkJavaHome.then.catch.then.then.catch.then.std (/Users/admin/node_modules/java-home/lib/java-home.js:89:25)
at process._tickCallback (internal/process/next_tick.js:103:7)
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "macaca-android" "--save"
npm ERR! node v6.9.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node ./script/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./script/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the android-unicode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./script/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs android-unicode
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls android-unicode
npm ERR! There is likely additional logging output above.

---split line-----then install android-unicode,failed again -------------

sudo npm install android-unicode

[email protected] install /Users/admin/node_modules/android-unicode
node ./script/build.js

Error: $JAVA_HOME is not set
at checkJavaHome.then.catch.then.then.catch.then.std (/Users/admin/node_modules/java-home/lib/java-home.js:89:25)
at process._tickCallback (internal/process/next_tick.js:103:7)
/Users/admin/node_modules/android-unicode/script/build.js:15
throw e;
^

Error: $JAVA_HOME is not set
at checkJavaHome.then.catch.then.then.catch.then.std (/Users/admin/node_modules/java-home/lib/java-home.js:89:25)
at process._tickCallback (internal/process/next_tick.js:103:7)
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "android-unicode"
npm ERR! node v6.9.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node ./script/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./script/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the android-unicode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./script/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs android-unicode
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls android-unicode
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/admin/npm-debug.log

npm i macaca-android --save failed

npm i macaca-android --save failed

[Error: build failed]
D:\sogou\work\macacajs\macaca-test-sample\node_modules\macaca-android\node_modul
es\unlock-apk\script\build.js:28
throw e;
^

Error: build failed
at ChildProcess. (D:\sogou\work\macacajs\macaca-test-sample\node_
modules\macaca-android\node_modules\unlock-apk\node_modules\ant-build\lib\ant-bu
ild.js:100:16)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

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.