What is the basic difference between adb shell input keyevent
and adb shell sendevent
? Which one should I use for inputting a character? Are the keycodes the same that we pass to both the commands?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Also, if you want to send embedded spaces with the input command, use %s
will yield
being input.
%
itself does not need escaping - only the special%s
pair is treated specially. This leads of course to the obvious question of how to enter the literal string%s
... which you would have to do with two separate commands.One other difference:
More detail code trace into inside AOSP Framework can be found here:
http://www.srcmap.org/sd_share/4/aba57bc6/AOSP_adb_shell_input_Code_Trace.html#RefId=7c8f5285
By
adb shell input keyevent
, either anevent_code
or astring
will be sent to the device.Some possible values for
event_code
are:The
sendevent
utility sends touch or keyboard events, as well as other events for simulating the hardware events. Refer to this article for details: Android, low level shell click on screen.By the way, if you are trying to find a way to send double quotes to the device, try the following:
I'm not sure why there's no event code for quotes, but this workaround does the job. Also, if you're using MonkeyDevice (or ChimpChat) you should test each caracter before invoking monkeyDevice.type, otherwise you get nothing when you try to send "
Updating:
Using
adb shell input
:..
..
..
..
..
If you want to send a text to specific device when multiple devices connected. First look for the attached devices using adb devices
then get your specific device id and try the following