Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何发送回车键? #8

Closed
zw963 opened this issue Mar 19, 2016 · 16 comments
Closed

请问如何发送回车键? #8

zw963 opened this issue Mar 19, 2016 · 16 comments

Comments

@zw963
Copy link

zw963 commented Mar 19, 2016

例如,我希望打一段中文,然后,立刻从 android 的 QQ 的聊天窗口发出去。

我有这样一个 bash 函数:

function adb_key () {
    adb shell am broadcast -a ADB_INPUT_TEXT --es msg "$*\n"
}

这里的 \n 似乎是无效的, 发了个 \n 到 QQ, 而不是回车。

@tkggusraqk
Copy link

兄弟,你的能输入中文吗,我测试 的怎么是乱码呀

@senzhk
Copy link
Owner

senzhk commented Apr 11, 2016

可以的 我是用中文試的啦。

@zw963
Copy link
Author

zw963 commented Apr 12, 2016

@tkggusraqk , 简单的中文没问题,不过有时候会失败,可能包含了一些特殊的标点符号,当时在聊天,没有记录下来。

@senzhk , 你咋不回复偶的问题呐? 谢谢。

@tkggusraqk
Copy link

@zw963 @senzhk 我的是一般的中文都不行呀,这里没办法发图,我的qq号:576501565,希望两位大神能不吝赐教

@zw963
Copy link
Author

zw963 commented Apr 26, 2016

@tkggusraqk , 你需要去设定里面激活 ADBKeyBoard 作为当前输入法。

如果不知道在那里设定,你可以装个搜狗, 它自己带了个输入法设定工具。

@senzhk , 为啥不回复我的问题? 支应一声?

@senzhk
Copy link
Owner

senzhk commented Apr 26, 2016

@billy 你说是\n 的问题,那我在README有写 \n 是特别键来的,要用CODE 来发,当然你可以把代码改成认\n 也可以。

Regards,
Eric

2016-04-26 22:13 GMT+08:00 Billy notifications@github.com:

@tkggusraqk https://github.com/tkggusraqk , 你需要去设定里面激活 ADBKeyBoard
作为当前输入法。

如果不知道在那里设定,你可以装个搜狗, 它自己带了个输入法设定工具。

@senzhk https://github.com/senzhk , 为啥不回复我的问题? 支应一声?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8 (comment)

@zw963
Copy link
Author

zw963 commented Apr 26, 2016

@billy 你说是\n 的问题,那我在README有写 \n 是特别键来的,要用CODE 来发,当然你可以把代码改成认\n 也可以。

谢谢, 刚刚注意到 README 有提及特殊字符。

不过没有提及 \n ?? 我看到 67 = KEYCODE_DEL,
这个 67, 貌似不是我知道的任何表。

我到那里去查看 \n 的数字?

谢。

@senzhk
Copy link
Owner

senzhk commented Apr 26, 2016

@billy
http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_ENTER

Regards,
Eric

2016-04-27 0:00 GMT+08:00 Billy notifications@github.com:

@billy https://github.com/Billy 你说是\n 的问题,那我在README有写 \n 是特别键来的,要用CODE
来发,当然你可以把代码改成认\n 也可以。

谢谢, 刚刚注意到 README 有提及特殊字符。

不过没有提及 \n ?? 我看到 67 = KEYCODE_DEL,
这个 67, 貌似不是我知道的任何表。

我到那里去查看 \n 的数字?

谢。


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8 (comment)

@zw963
Copy link
Author

zw963 commented Apr 26, 2016

已试可用, 回车键是 66, 谢谢。

@zw963 zw963 closed this as completed Apr 26, 2016
@zw963
Copy link
Author

zw963 commented Apr 26, 2016

在我手机上, QQ 轻聊版不可用, 应该是 app 的问题。
但是, 微信可用。 聊天省事儿多了。

@tkggusraqk
Copy link

@zw963 我设置了,还是不起作用,你加我qq:576501565

@tkggusraqk
Copy link

@senzhk 我的是windows 系统 用adb 连接 命令行调试,确实不行呀,接收到的是乱码
我用android studio 调试看了,中文收到的就是乱码。怎么解决呢,很着急,求大神赐教一下,我qq:576501565

@zw963
Copy link
Author

zw963 commented Apr 27, 2016

我几乎不上 QQ 啊。
再说, Windows 下我也帮不到你了, 我没在 Windows 下用过 adb.

我怀疑是你发送的字符采用的编码是 GBK, 而不是 Linux 默认支持的 UTF-8.
你你可以 Google 下 adb 编码的问题。

@zw963
Copy link
Author

zw963 commented Apr 27, 2016

或者问下作者,编码支持是不是加个啥参数就可以了。

@tkggusraqk
Copy link

@zw963 我已经解决了,我也没有去解决编码问题,我是直接把要传输的内容转换成字节 ,然后再还原。
@senzhk 谢谢提供的这个keyborad

@colordancer
Copy link

@tkggusraqk 怎么解决的?能否贴段代码?
这里也看到有人和你问一样的问题:http://smilejay.com/2014/12/adb-shell-input-chinese-character/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants