ADB Shell 输入事件

发布于 2024-12-10 10:11:07 字数 123 浏览 0 评论 0原文

adb shell input keyeventadb shell sendevent 之间的基本区别是什么?我应该使用哪一个来输入字符?我们传递给这两个命令的键码是否相同?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

橪书 2024-12-17 10:11:07

通过 adb shell input keyeventevent_codestring 将被发送到设备。

usage: input [text|keyevent]
  input text <string>
  input keyevent <event_code>

event_code 的一些可能值包括:

0 -->  "KEYCODE_UNKNOWN" 
1 -->  "KEYCODE_MENU" 
2 -->  "KEYCODE_SOFT_RIGHT" 
3 -->  "KEYCODE_HOME" 
4 -->  "KEYCODE_BACK" 
5 -->  "KEYCODE_CALL" 
6 -->  "KEYCODE_ENDCALL" 
7 -->  "KEYCODE_0" 
8 -->  "KEYCODE_1" 
9 -->  "KEYCODE_2" 
10 -->  "KEYCODE_3" 
11 -->  "KEYCODE_4" 
12 -->  "KEYCODE_5" 
13 -->  "KEYCODE_6" 
14 -->  "KEYCODE_7" 
15 -->  "KEYCODE_8" 
16 -->  "KEYCODE_9" 
17 -->  "KEYCODE_STAR" 
18 -->  "KEYCODE_POUND" 
19 -->  "KEYCODE_DPAD_UP" 
20 -->  "KEYCODE_DPAD_DOWN" 
21 -->  "KEYCODE_DPAD_LEFT" 
22 -->  "KEYCODE_DPAD_RIGHT" 
23 -->  "KEYCODE_DPAD_CENTER" 
24 -->  "KEYCODE_VOLUME_UP" 
25 -->  "KEYCODE_VOLUME_DOWN" 
26 -->  "KEYCODE_POWER" 
27 -->  "KEYCODE_CAMERA" 
28 -->  "KEYCODE_CLEAR" 
29 -->  "KEYCODE_A" 
30 -->  "KEYCODE_B" 
31 -->  "KEYCODE_C" 
32 -->  "KEYCODE_D" 
33 -->  "KEYCODE_E" 
34 -->  "KEYCODE_F" 
35 -->  "KEYCODE_G" 
36 -->  "KEYCODE_H" 
37 -->  "KEYCODE_I" 
38 -->  "KEYCODE_J" 
39 -->  "KEYCODE_K" 
40 -->  "KEYCODE_L" 
41 -->  "KEYCODE_M" 
42 -->  "KEYCODE_N" 
43 -->  "KEYCODE_O" 
44 -->  "KEYCODE_P" 
45 -->  "KEYCODE_Q" 
46 -->  "KEYCODE_R" 
47 -->  "KEYCODE_S" 
48 -->  "KEYCODE_T" 
49 -->  "KEYCODE_U" 
50 -->  "KEYCODE_V" 
51 -->  "KEYCODE_W" 
52 -->  "KEYCODE_X" 
53 -->  "KEYCODE_Y" 
54 -->  "KEYCODE_Z" 
55 -->  "KEYCODE_COMMA" 
56 -->  "KEYCODE_PERIOD" 
57 -->  "KEYCODE_ALT_LEFT" 
58 -->  "KEYCODE_ALT_RIGHT" 
59 -->  "KEYCODE_SHIFT_LEFT" 
60 -->  "KEYCODE_SHIFT_RIGHT" 
61 -->  "KEYCODE_TAB" 
62 -->  "KEYCODE_SPACE" 
63 -->  "KEYCODE_SYM" 
64 -->  "KEYCODE_EXPLORER" 
65 -->  "KEYCODE_ENVELOPE" 
66 -->  "KEYCODE_ENTER" 
67 -->  "KEYCODE_DEL" 
68 -->  "KEYCODE_GRAVE" 
69 -->  "KEYCODE_MINUS" 
70 -->  "KEYCODE_EQUALS" 
71 -->  "KEYCODE_LEFT_BRACKET" 
72 -->  "KEYCODE_RIGHT_BRACKET" 
73 -->  "KEYCODE_BACKSLASH" 
74 -->  "KEYCODE_SEMICOLON" 
75 -->  "KEYCODE_APOSTROPHE" 
76 -->  "KEYCODE_SLASH" 
77 -->  "KEYCODE_AT" 
78 -->  "KEYCODE_NUM" 
79 -->  "KEYCODE_HEADSETHOOK" 
80 -->  "KEYCODE_FOCUS" 
81 -->  "KEYCODE_PLUS" 
82 -->  "KEYCODE_MENU" 
83 -->  "KEYCODE_NOTIFICATION" 
84 -->  "KEYCODE_SEARCH" 
85 -->  "TAG_LAST_KEYCODE"

sendevent 实用程序发送触摸或键盘事件,以及用于模拟硬件事件的其他事件。有关详细信息,请参阅本文: Android,低级 shell 点击屏幕

By adb shell input keyevent, either an event_code or a string will be sent to the device.

usage: input [text|keyevent]
  input text <string>
  input keyevent <event_code>

Some possible values for event_code are:

0 -->  "KEYCODE_UNKNOWN" 
1 -->  "KEYCODE_MENU" 
2 -->  "KEYCODE_SOFT_RIGHT" 
3 -->  "KEYCODE_HOME" 
4 -->  "KEYCODE_BACK" 
5 -->  "KEYCODE_CALL" 
6 -->  "KEYCODE_ENDCALL" 
7 -->  "KEYCODE_0" 
8 -->  "KEYCODE_1" 
9 -->  "KEYCODE_2" 
10 -->  "KEYCODE_3" 
11 -->  "KEYCODE_4" 
12 -->  "KEYCODE_5" 
13 -->  "KEYCODE_6" 
14 -->  "KEYCODE_7" 
15 -->  "KEYCODE_8" 
16 -->  "KEYCODE_9" 
17 -->  "KEYCODE_STAR" 
18 -->  "KEYCODE_POUND" 
19 -->  "KEYCODE_DPAD_UP" 
20 -->  "KEYCODE_DPAD_DOWN" 
21 -->  "KEYCODE_DPAD_LEFT" 
22 -->  "KEYCODE_DPAD_RIGHT" 
23 -->  "KEYCODE_DPAD_CENTER" 
24 -->  "KEYCODE_VOLUME_UP" 
25 -->  "KEYCODE_VOLUME_DOWN" 
26 -->  "KEYCODE_POWER" 
27 -->  "KEYCODE_CAMERA" 
28 -->  "KEYCODE_CLEAR" 
29 -->  "KEYCODE_A" 
30 -->  "KEYCODE_B" 
31 -->  "KEYCODE_C" 
32 -->  "KEYCODE_D" 
33 -->  "KEYCODE_E" 
34 -->  "KEYCODE_F" 
35 -->  "KEYCODE_G" 
36 -->  "KEYCODE_H" 
37 -->  "KEYCODE_I" 
38 -->  "KEYCODE_J" 
39 -->  "KEYCODE_K" 
40 -->  "KEYCODE_L" 
41 -->  "KEYCODE_M" 
42 -->  "KEYCODE_N" 
43 -->  "KEYCODE_O" 
44 -->  "KEYCODE_P" 
45 -->  "KEYCODE_Q" 
46 -->  "KEYCODE_R" 
47 -->  "KEYCODE_S" 
48 -->  "KEYCODE_T" 
49 -->  "KEYCODE_U" 
50 -->  "KEYCODE_V" 
51 -->  "KEYCODE_W" 
52 -->  "KEYCODE_X" 
53 -->  "KEYCODE_Y" 
54 -->  "KEYCODE_Z" 
55 -->  "KEYCODE_COMMA" 
56 -->  "KEYCODE_PERIOD" 
57 -->  "KEYCODE_ALT_LEFT" 
58 -->  "KEYCODE_ALT_RIGHT" 
59 -->  "KEYCODE_SHIFT_LEFT" 
60 -->  "KEYCODE_SHIFT_RIGHT" 
61 -->  "KEYCODE_TAB" 
62 -->  "KEYCODE_SPACE" 
63 -->  "KEYCODE_SYM" 
64 -->  "KEYCODE_EXPLORER" 
65 -->  "KEYCODE_ENVELOPE" 
66 -->  "KEYCODE_ENTER" 
67 -->  "KEYCODE_DEL" 
68 -->  "KEYCODE_GRAVE" 
69 -->  "KEYCODE_MINUS" 
70 -->  "KEYCODE_EQUALS" 
71 -->  "KEYCODE_LEFT_BRACKET" 
72 -->  "KEYCODE_RIGHT_BRACKET" 
73 -->  "KEYCODE_BACKSLASH" 
74 -->  "KEYCODE_SEMICOLON" 
75 -->  "KEYCODE_APOSTROPHE" 
76 -->  "KEYCODE_SLASH" 
77 -->  "KEYCODE_AT" 
78 -->  "KEYCODE_NUM" 
79 -->  "KEYCODE_HEADSETHOOK" 
80 -->  "KEYCODE_FOCUS" 
81 -->  "KEYCODE_PLUS" 
82 -->  "KEYCODE_MENU" 
83 -->  "KEYCODE_NOTIFICATION" 
84 -->  "KEYCODE_SEARCH" 
85 -->  "TAG_LAST_KEYCODE"

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.

紫南 2024-12-17 10:11:07

更新:

使用adb shell 输入

插入文字:

adb shell 输入文本“insert%syour%stext%shere”

<块引用>

(obs:%s 表示空格)

..

事件代码:

adb shell 输入 keyevent 82

<块引用>

(82 ---> MENU_BUTTON)

<块引用>
<块引用>

“有关更多按键事件代码,请参阅下面的列表”


..

点击 X、Y 位置:

adb shell 输入 Tap 500 1450

<块引用>

要找到您想要点击的确切 X、Y 位置,请转到:

<块引用>

设置>开发者选项>检查“指针位置”选项

..

滑动 X1 Y1 X2 Y2 [持续时间(毫秒)]:

adb shell 输入滑动 100 500 100 1450 100

<块引用>

在此示例中,X1=100,Y1=500,X2=100,Y2=1450,持续时间 = 100ms

..

长按 XY:

adb shell 输入滑动 100 500 100 500 250

<块引用>

我们使用相同的滑动命令来模拟长按

<块引用>

在此示例中,X=100,Y=500,持续时间 = 250ms

..

事件代码更新列表:

0 -->  "KEYCODE_0" 
1 -->  "KEYCODE_SOFT_LEFT" 
2 -->  "KEYCODE_SOFT_RIGHT" 
3 -->  "KEYCODE_HOME" 
4 -->  "KEYCODE_BACK" 
5 -->  "KEYCODE_CALL" 
6 -->  "KEYCODE_ENDCALL" 
7 -->  "KEYCODE_0" 
8 -->  "KEYCODE_1" 
9 -->  "KEYCODE_2" 
10 -->  "KEYCODE_3" 
11 -->  "KEYCODE_4" 
12 -->  "KEYCODE_5" 
13 -->  "KEYCODE_6" 
14 -->  "KEYCODE_7" 
15 -->  "KEYCODE_8" 
16 -->  "KEYCODE_9" 
17 -->  "KEYCODE_STAR" 
18 -->  "KEYCODE_POUND" 
19 -->  "KEYCODE_DPAD_UP" 
20 -->  "KEYCODE_DPAD_DOWN" 
21 -->  "KEYCODE_DPAD_LEFT" 
22 -->  "KEYCODE_DPAD_RIGHT" 
23 -->  "KEYCODE_DPAD_CENTER" 
24 -->  "KEYCODE_VOLUME_UP" 
25 -->  "KEYCODE_VOLUME_DOWN" 
26 -->  "KEYCODE_POWER" 
27 -->  "KEYCODE_CAMERA" 
28 -->  "KEYCODE_CLEAR" 
29 -->  "KEYCODE_A" 
30 -->  "KEYCODE_B" 
31 -->  "KEYCODE_C" 
32 -->  "KEYCODE_D" 
33 -->  "KEYCODE_E" 
34 -->  "KEYCODE_F" 
35 -->  "KEYCODE_G" 
36 -->  "KEYCODE_H" 
37 -->  "KEYCODE_I" 
38 -->  "KEYCODE_J" 
39 -->  "KEYCODE_K" 
40 -->  "KEYCODE_L" 
41 -->  "KEYCODE_M" 
42 -->  "KEYCODE_N" 
43 -->  "KEYCODE_O" 
44 -->  "KEYCODE_P" 
45 -->  "KEYCODE_Q" 
46 -->  "KEYCODE_R" 
47 -->  "KEYCODE_S" 
48 -->  "KEYCODE_T" 
49 -->  "KEYCODE_U" 
50 -->  "KEYCODE_V" 
51 -->  "KEYCODE_W" 
52 -->  "KEYCODE_X" 
53 -->  "KEYCODE_Y" 
54 -->  "KEYCODE_Z" 
55 -->  "KEYCODE_COMMA" 
56 -->  "KEYCODE_PERIOD" 
57 -->  "KEYCODE_ALT_LEFT" 
58 -->  "KEYCODE_ALT_RIGHT" 
59 -->  "KEYCODE_SHIFT_LEFT" 
60 -->  "KEYCODE_SHIFT_RIGHT" 
61 -->  "KEYCODE_TAB" 
62 -->  "KEYCODE_SPACE" 
63 -->  "KEYCODE_SYM" 
64 -->  "KEYCODE_EXPLORER" 
65 -->  "KEYCODE_ENVELOPE" 
66 -->  "KEYCODE_ENTER" 
67 -->  "KEYCODE_DEL" 
68 -->  "KEYCODE_GRAVE" 
69 -->  "KEYCODE_MINUS" 
70 -->  "KEYCODE_EQUALS" 
71 -->  "KEYCODE_LEFT_BRACKET" 
72 -->  "KEYCODE_RIGHT_BRACKET" 
73 -->  "KEYCODE_BACKSLASH" 
74 -->  "KEYCODE_SEMICOLON" 
75 -->  "KEYCODE_APOSTROPHE" 
76 -->  "KEYCODE_SLASH" 
77 -->  "KEYCODE_AT" 
78 -->  "KEYCODE_NUM" 
79 -->  "KEYCODE_HEADSETHOOK" 
80 -->  "KEYCODE_FOCUS" 
81 -->  "KEYCODE_PLUS" 
82 -->  "KEYCODE_MENU" 
83 -->  "KEYCODE_NOTIFICATION" 
84 -->  "KEYCODE_SEARCH" 
85 -->  "KEYCODE_MEDIA_PLAY_PAUSE"
86 -->  "KEYCODE_MEDIA_STOP"
87 -->  "KEYCODE_MEDIA_NEXT"
88 -->  "KEYCODE_MEDIA_PREVIOUS"
89 -->  "KEYCODE_MEDIA_REWIND"
90 -->  "KEYCODE_MEDIA_FAST_FORWARD"
91 -->  "KEYCODE_MUTE"
92 -->  "KEYCODE_PAGE_UP"
93 -->  "KEYCODE_PAGE_DOWN"
94 -->  "KEYCODE_PICTSYMBOLS"
...
122 -->  "KEYCODE_MOVE_HOME"
123 -->  "KEYCODE_MOVE_END"

完整的命令列表可以在以下位置找到:
http://developer.android.com/reference/android/view/KeyEvent。 html

Updating:

Using adb shell input:

Insert text:

adb shell input text "insert%syour%stext%shere"

(obs: %s means SPACE)

..

Event codes:

adb shell input keyevent 82

(82 ---> MENU_BUTTON)

"For more keyevents codes see list below"

..

Tap X,Y position:

adb shell input tap 500 1450

To find the exact X,Y position you want to Tap go to:

Settings > Developer Options > Check the option POINTER SLOCATION

..

Swipe X1 Y1 X2 Y2 [duration(ms)]:

adb shell input swipe 100 500 100 1450 100

in this example X1=100, Y1=500, X2=100, Y2=1450, Duration = 100ms

..

LongPress X Y:

adb shell input swipe 100 500 100 500 250

we utilise the same command for a swipe to emulate a long press

in this example X=100, Y=500, Duration = 250ms

..

Event Codes Updated List:

0 -->  "KEYCODE_0" 
1 -->  "KEYCODE_SOFT_LEFT" 
2 -->  "KEYCODE_SOFT_RIGHT" 
3 -->  "KEYCODE_HOME" 
4 -->  "KEYCODE_BACK" 
5 -->  "KEYCODE_CALL" 
6 -->  "KEYCODE_ENDCALL" 
7 -->  "KEYCODE_0" 
8 -->  "KEYCODE_1" 
9 -->  "KEYCODE_2" 
10 -->  "KEYCODE_3" 
11 -->  "KEYCODE_4" 
12 -->  "KEYCODE_5" 
13 -->  "KEYCODE_6" 
14 -->  "KEYCODE_7" 
15 -->  "KEYCODE_8" 
16 -->  "KEYCODE_9" 
17 -->  "KEYCODE_STAR" 
18 -->  "KEYCODE_POUND" 
19 -->  "KEYCODE_DPAD_UP" 
20 -->  "KEYCODE_DPAD_DOWN" 
21 -->  "KEYCODE_DPAD_LEFT" 
22 -->  "KEYCODE_DPAD_RIGHT" 
23 -->  "KEYCODE_DPAD_CENTER" 
24 -->  "KEYCODE_VOLUME_UP" 
25 -->  "KEYCODE_VOLUME_DOWN" 
26 -->  "KEYCODE_POWER" 
27 -->  "KEYCODE_CAMERA" 
28 -->  "KEYCODE_CLEAR" 
29 -->  "KEYCODE_A" 
30 -->  "KEYCODE_B" 
31 -->  "KEYCODE_C" 
32 -->  "KEYCODE_D" 
33 -->  "KEYCODE_E" 
34 -->  "KEYCODE_F" 
35 -->  "KEYCODE_G" 
36 -->  "KEYCODE_H" 
37 -->  "KEYCODE_I" 
38 -->  "KEYCODE_J" 
39 -->  "KEYCODE_K" 
40 -->  "KEYCODE_L" 
41 -->  "KEYCODE_M" 
42 -->  "KEYCODE_N" 
43 -->  "KEYCODE_O" 
44 -->  "KEYCODE_P" 
45 -->  "KEYCODE_Q" 
46 -->  "KEYCODE_R" 
47 -->  "KEYCODE_S" 
48 -->  "KEYCODE_T" 
49 -->  "KEYCODE_U" 
50 -->  "KEYCODE_V" 
51 -->  "KEYCODE_W" 
52 -->  "KEYCODE_X" 
53 -->  "KEYCODE_Y" 
54 -->  "KEYCODE_Z" 
55 -->  "KEYCODE_COMMA" 
56 -->  "KEYCODE_PERIOD" 
57 -->  "KEYCODE_ALT_LEFT" 
58 -->  "KEYCODE_ALT_RIGHT" 
59 -->  "KEYCODE_SHIFT_LEFT" 
60 -->  "KEYCODE_SHIFT_RIGHT" 
61 -->  "KEYCODE_TAB" 
62 -->  "KEYCODE_SPACE" 
63 -->  "KEYCODE_SYM" 
64 -->  "KEYCODE_EXPLORER" 
65 -->  "KEYCODE_ENVELOPE" 
66 -->  "KEYCODE_ENTER" 
67 -->  "KEYCODE_DEL" 
68 -->  "KEYCODE_GRAVE" 
69 -->  "KEYCODE_MINUS" 
70 -->  "KEYCODE_EQUALS" 
71 -->  "KEYCODE_LEFT_BRACKET" 
72 -->  "KEYCODE_RIGHT_BRACKET" 
73 -->  "KEYCODE_BACKSLASH" 
74 -->  "KEYCODE_SEMICOLON" 
75 -->  "KEYCODE_APOSTROPHE" 
76 -->  "KEYCODE_SLASH" 
77 -->  "KEYCODE_AT" 
78 -->  "KEYCODE_NUM" 
79 -->  "KEYCODE_HEADSETHOOK" 
80 -->  "KEYCODE_FOCUS" 
81 -->  "KEYCODE_PLUS" 
82 -->  "KEYCODE_MENU" 
83 -->  "KEYCODE_NOTIFICATION" 
84 -->  "KEYCODE_SEARCH" 
85 -->  "KEYCODE_MEDIA_PLAY_PAUSE"
86 -->  "KEYCODE_MEDIA_STOP"
87 -->  "KEYCODE_MEDIA_NEXT"
88 -->  "KEYCODE_MEDIA_PREVIOUS"
89 -->  "KEYCODE_MEDIA_REWIND"
90 -->  "KEYCODE_MEDIA_FAST_FORWARD"
91 -->  "KEYCODE_MUTE"
92 -->  "KEYCODE_PAGE_UP"
93 -->  "KEYCODE_PAGE_DOWN"
94 -->  "KEYCODE_PICTSYMBOLS"
...
122 -->  "KEYCODE_MOVE_HOME"
123 -->  "KEYCODE_MOVE_END"

The complete list of commands can be found on:
http://developer.android.com/reference/android/view/KeyEvent.html

雨后咖啡店 2024-12-17 10:11:07

另外,如果您想使用输入命令发送嵌入的空格,请使用 %s

adb shell input text 'this%sis%san%sexample'   

将产生

这是一个例子

正在输入的示例。

% 本身不需要转义 - 只有特殊的 %s 对才会被特殊处理。这当然会导致一个明显的问题,即如何输入文字字符串 %s,您必须使用两个单独的命令来完成此操作。

Also, if you want to send embedded spaces with the input command, use %s

adb shell input text 'this%sis%san%sexample'   

will yield

this is an example

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.

静若繁花 2024-12-17 10:11:07

我为 Windows 用户编写了一个简单的 Powershell 脚本,将按键映射到 adb shell 输入事件。并通过 LAN 远程控制 Android 设备。
不知道有没有人觉得有用,不过我还是分享一下。

$ip = 192.168.1.8
cd D:\Android\android-sdk-windows\platform-tools\; .\adb.exe disconnect $ip; .\adb.exe connect $ip
$adbKeyNum = @{LeftWindows = "1"; F1 = "3"; Enter = "66"; UpArrow = "19"; DownArrow = "20"; LeftArrow = "21"; RightArrow = "22"; Add = "24";
        Subtract = "25"; Backspace = "4"; P = "26"}

while(1 -eq 1){
    $keyPress = [Console]::ReadKey($true).Key
    if ([string]$keyPress -eq "F10"){
        .\adb.exe disconnect $ip
        exit
    }
    elseif ([string]$keyPress -eq "F6"){
        $string = Read-Host -Prompt 'Input the string: '
        .\adb.exe shell input text $string
    }
    elseif ($adbKeyNum.ContainsKey([string]$keyPress)){
        echo $adbKeyNum.Get_Item([string]$keyPress)
        .\adb.exe shell input keyevent $adbKeyNum.Get_Item([string]$keyPress)
    }
}

I wrote a simple Powershell script for windows users to map keys to adb shell input events. And controll an Android device remotely over LAN.
I don't know if anyone finds it usefull, but I'll share it anyways.

$ip = 192.168.1.8
cd D:\Android\android-sdk-windows\platform-tools\; .\adb.exe disconnect $ip; .\adb.exe connect $ip
$adbKeyNum = @{LeftWindows = "1"; F1 = "3"; Enter = "66"; UpArrow = "19"; DownArrow = "20"; LeftArrow = "21"; RightArrow = "22"; Add = "24";
        Subtract = "25"; Backspace = "4"; P = "26"}

while(1 -eq 1){
    $keyPress = [Console]::ReadKey($true).Key
    if ([string]$keyPress -eq "F10"){
        .\adb.exe disconnect $ip
        exit
    }
    elseif ([string]$keyPress -eq "F6"){
        $string = Read-Host -Prompt 'Input the string: '
        .\adb.exe shell input text $string
    }
    elseif ($adbKeyNum.ContainsKey([string]$keyPress)){
        echo $adbKeyNum.Get_Item([string]$keyPress)
        .\adb.exe shell input keyevent $adbKeyNum.Get_Item([string]$keyPress)
    }
}
我要还你自由 2024-12-17 10:11:07

另一个区别是:

  • adb shell input”是调用 input.jar 来处理并发送来自 android 框架的 Java 层的按键代码。
  • adb sendevent”实际上是c代码(工具箱实用程序的一部分),它将输入代码直接发送到Linux输入子系统的/dev/input...。

可以在此处找到 AOSP 框架内部的更多详细代码跟踪:

http://www.srcmap.org/sd_share/4/aba57bc6/AOSP_adb_shell_input_Code_Trace.html#RefId=7c8f5285

One other difference:

  • "adb shell input" is calling the input.jar to process and send the keycode from the Java layer of the android framework.
  • "adb sendevent" is actually c code (part of toolbox utility ) that sends the input code directly into the /dev/input.... of Linux input subsystem.

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

别挽留 2024-12-17 10:11:07

顺便说一句,如果您试图找到一种将双引号发送到设备的方法,请尝试以下操作:

adb shell 输入文本 '\"'

我不确定为什么没有引号的事件代码,但这个解决方法可以完成这项工作。另外,如果您使用 MonkeyDevice (或 ChimpChat),您应该在调用 MonkeyDevice.type 之前测试每个字符,否则当你尝试发送时你什么也得不到”

By the way, if you are trying to find a way to send double quotes to the device, try the following:

adb shell input text '\"'

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 "

So要识趣 2024-12-17 10:11:07

如果您想在多个设备连接时向特定设备发送文本。首先使用 adb devices 查找连接的设备,

adb devices
List of devices attached
3004e25a57192200        device
31002d9e592b7300        device

然后获取您的特定设备 ID 并尝试以下操作

adb -s 31002d9e592b7300 shell input text 'your%stext'

If you want to send a text to specific device when multiple devices connected. First look for the attached devices using adb devices

adb devices
List of devices attached
3004e25a57192200        device
31002d9e592b7300        device

then get your specific device id and try the following

adb -s 31002d9e592b7300 shell input text 'your%stext'
独守阴晴ぅ圆缺 2024-12-17 10:11:07

参考号仓库:ADB Automate Android 手机

{    
    "key_events": {
        "key_unknown": "adb shell input keyevent 0",
        "key_soft_left": "adb shell input keyevent 1",
        "key_soft_right": "adb shell input keyevent 2",
        "key_home": "adb shell input keyevent 3",
        "key_back": "adb shell input keyevent 4",
        "key_call": "adb shell input keyevent 5",
        "key_endcall": "adb shell input keyevent 6",
        "key_0": "adb shell input keyevent 7",
        "key_1": "adb shell input keyevent 8",
        "key_2": "adb shell input keyevent 9",
        "key_3": "adb shell input keyevent 10",
        "key_4": "adb shell input keyevent 11",
        "key_5": "adb shell input keyevent 12",
        "key_6": "adb shell input keyevent 13",
        "key_7": "adb shell input keyevent 14",
        "key_8": "adb shell input keyevent 15",
        "key_9": "adb shell input keyevent 16",
        "key_star": "adb shell input keyevent 17",
        "key_pound": "adb shell input keyevent 18",
        "key_dpad_up": "adb shell input keyevent 19",
        "key_dpad_down": "adb shell input keyevent 20",
        "key_dpad_left": "adb shell input keyevent 21",
        "key_dpad_right": "adb shell input keyevent 22",
        "key_dpad_center": "adb shell input keyevent 23",
        "key_volume_up": "adb shell input keyevent 24",
        "key_volume_down": "adb shell input keyevent 25",
        "key_power": "adb shell input keyevent 26",
        "key_camera": "adb shell input keyevent 27",
        "key_clear": "adb shell input keyevent 28",
        "key_a": "adb shell input keyevent 29",
        "key_b": "adb shell input keyevent 30",
        "key_c": "adb shell input keyevent 31",
        "key_d": "adb shell input keyevent 32",
        "key_e": "adb shell input keyevent 33",
        "key_f": "adb shell input keyevent 34",
        "key_g": "adb shell input keyevent 35",
        "key_h": "adb shell input keyevent 36",
        "key_i": "adb shell input keyevent 37",
        "key_j": "adb shell input keyevent 38",
        "key_k": "adb shell input keyevent 39",
        "key_l": "adb shell input keyevent 40",
        "key_m": "adb shell input keyevent 41",
        "key_n": "adb shell input keyevent 42",
        "key_o": "adb shell input keyevent 43",
        "key_p": "adb shell input keyevent 44",
        "key_q": "adb shell input keyevent 45",
        "key_r": "adb shell input keyevent 46",
        "key_s": "adb shell input keyevent 47",
        "key_t": "adb shell input keyevent 48",
        "key_u": "adb shell input keyevent 49",
        "key_v": "adb shell input keyevent 50",
        "key_w": "adb shell input keyevent 51",
        "key_x": "adb shell input keyevent 52",
        "key_y": "adb shell input keyevent 53",
        "key_z": "adb shell input keyevent 54",
        "key_comma": "adb shell input keyevent 55",
        "key_period": "adb shell input keyevent 56",
        "key_alt_left": "adb shell input keyevent 57",
        "key_alt_right": "adb shell input keyevent 58",
        "key_shift_left": "adb shell input keyevent 59",
        "key_shift_right": "adb shell input keyevent 60",
        "key_tab": "adb shell input keyevent 61",
        "key_space": "adb shell input keyevent 62",
        "key_sym": "adb shell input keyevent 63",
        "key_explorer": "adb shell input keyevent 64",
        "key_envelope": "adb shell input keyevent 65",
        "key_enter": "adb shell input keyevent 66",
        "key_del": "adb shell input keyevent 67",
        "key_grave": "adb shell input keyevent 68",
        "key_minus": "adb shell input keyevent 69",
        "key_equals": "adb shell input keyevent 70",
        "key_left_bracket": "adb shell input keyevent 71",
        "key_right_bracket": "adb shell input keyevent 72",
        "key_backslash": "adb shell input keyevent 73",
        "key_semicolon": "adb shell input keyevent 74",
        "key_apostrophe": "adb shell input keyevent 75",
        "key_slash": "adb shell input keyevent 76",
        "key_at": "adb shell input keyevent 77",
        "key_num": "adb shell input keyevent 78",
        "key_headsethook": "adb shell input keyevent 79",
        "key_focus": "adb shell input keyevent 80",
        "key_plus": "adb shell input keyevent 81",
        "key_menu": "adb shell input keyevent 82",
        "key_notification": "adb shell input keyevent 83",
        "key_search": "adb shell input keyevent 84",
        "key_media_play_pause": "adb shell input keyevent 85",
        "key_media_stop": "adb shell input keyevent 86",
        "key_media_next": "adb shell input keyevent 87",
        "key_media_previous": "adb shell input keyevent 88",
        "key_media_rewind": "adb shell input keyevent 89",
        "key_media_fast_forward": "adb shell input keyevent 90",
        "key_mute": "adb shell input keyevent 91",
        "key_page_up": "adb shell input keyevent 92",
        "key_page_down": "adb shell input keyevent 93",
        "key_pictsymbols": "adb shell input keyevent 94",
        "key_switch_charset": "adb shell input keyevent 95",
        "key_button_a": "adb shell input keyevent 96",
        "key_button_b": "adb shell input keyevent 97",
        "key_button_c": "adb shell input keyevent 98",
        "key_button_x": "adb shell input keyevent 99",
        "key_button_y": "adb shell input keyevent 100",
        "key_button_z": "adb shell input keyevent 101",
        "key_button_l1": "adb shell input keyevent 102",
        "key_button_r1": "adb shell input keyevent 103",
        "key_button_l2": "adb shell input keyevent 104",
        "key_button_r2": "adb shell input keyevent 105",
        "key_button_thumbl": "adb shell input keyevent 106",
        "key_button_thumbr": "adb shell input keyevent 107",
        "key_button_start": "adb shell input keyevent 108",
        "key_button_select": "adb shell input keyevent 109",
        "key_button_mode": "adb shell input keyevent 110",
        "key_escape": "adb shell input keyevent 111",
        "key_forward_del": "adb shell input keyevent 112",
        "key_ctrl_left": "adb shell input keyevent 113",
        "key_ctrl_right": "adb shell input keyevent 114",
        "key_caps_lock": "adb shell input keyevent 115",
        "key_scroll_lock": "adb shell input keyevent 116",
        "key_meta_left": "adb shell input keyevent 117",
        "key_meta_right": "adb shell input keyevent 118",
        "key_function": "adb shell input keyevent 119",
        "key_sysrq": "adb shell input keyevent 120",
        "key_break": "adb shell input keyevent 121",
        "key_move_home": "adb shell input keyevent 122",
        "key_move_end": "adb shell input keyevent 123",
        "key_insert": "adb shell input keyevent 124",
        "key_forward": "adb shell input keyevent 125",
        "key_media_play": "adb shell input keyevent 126",
        "key_media_pause": "adb shell input keyevent 127",
        "key_media_close": "adb shell input keyevent 128",
        "key_media_eject": "adb shell input keyevent 129",
        "key_media_record": "adb shell input keyevent 130",
        "key_f1": "adb shell input keyevent 131",
        "key_f2": "adb shell input keyevent 132",
        "key_f3": "adb shell input keyevent 133",
        "key_f4": "adb shell input keyevent 134",
        "key_f5": "adb shell input keyevent 135",
        "key_f6": "adb shell input keyevent 136",
        "key_f7": "adb shell input keyevent 137",
        "key_f8": "adb shell input keyevent 138",
        "key_f9": "adb shell input keyevent 139",
        "key_f10": "adb shell input keyevent 140",
        "key_f11": "adb shell input keyevent 141",
        "key_f12": "adb shell input keyevent 142",
        "key_num_lock": "adb shell input keyevent 143",
        "key_numpad_0": "adb shell input keyevent 144",
        "key_numpad_1": "adb shell input keyevent 145",
        "key_numpad_2": "adb shell input keyevent 146",
        "key_numpad_3": "adb shell input keyevent 147",
        "key_numpad_4": "adb shell input keyevent 148",
        "key_numpad_5": "adb shell input keyevent 149",
        "key_numpad_6": "adb shell input keyevent 150",
        "key_numpad_7": "adb shell input keyevent 151",
        "key_numpad_8": "adb shell input keyevent 152",
        "key_numpad_9": "adb shell input keyevent 153",
        "key_numpad_divide": "adb shell input keyevent 154",
        "key_numpad_multiply": "adb shell input keyevent 155",
        "key_numpad_subtract": "adb shell input keyevent 156",
        "key_numpad_add": "adb shell input keyevent 157",
        "key_numpad_dot": "adb shell input keyevent 158",
        "key_numpad_comma": "adb shell input keyevent 159",
        "key_numpad_enter": "adb shell input keyevent 160",
        "key_numpad_equals": "adb shell input keyevent 161",
        "key_numpad_left_paren": "adb shell input keyevent 162",
        "key_numpad_right_paren": "adb shell input keyevent 163",
        "key_volume_mute": "adb shell input keyevent 164",
        "key_info": "adb shell input keyevent 165",
        "key_channel_up": "adb shell input keyevent 166",
        "key_channel_down": "adb shell input keyevent 167",
        "key_zoom_in": "adb shell input keyevent 168",
        "key_zoom_out": "adb shell input keyevent 169",
        "key_tv": "adb shell input keyevent 170",
        "key_window": "adb shell input keyevent 171",
        "key_guide": "adb shell input keyevent 172",
        "key_dvr": "adb shell input keyevent 173",
        "key_bookmark": "adb shell input keyevent 174",
        "key_captions": "adb shell input keyevent 175",
        "key_settings": "adb shell input keyevent 176",
        "key_tv_power": "adb shell input keyevent 177",
        "key_tv_input": "adb shell input keyevent 178",
        "key_stb_power": "adb shell input keyevent 179",
        "key_stb_input": "adb shell input keyevent 180",
        "key_avr_power": "adb shell input keyevent 181",
        "key_avr_input": "adb shell input keyevent 182",
        "key_prog_red": "adb shell input keyevent 183",
        "key_prog_green": "adb shell input keyevent 184",
        "key_prog_yellow": "adb shell input keyevent 185",
        "key_prog_blue": "adb shell input keyevent 186",
        "key_app_switch": "adb shell input keyevent 187",
        "key_button_1": "adb shell input keyevent 188",
        "key_button_2": "adb shell input keyevent 189",
        "key_button_3": "adb shell input keyevent 190",
        "key_button_4": "adb shell input keyevent 191",
        "key_button_5": "adb shell input keyevent 192",
        "key_button_6": "adb shell input keyevent 193",
        "key_button_7": "adb shell input keyevent 194",
        "key_button_8": "adb shell input keyevent 195",
        "key_button_9": "adb shell input keyevent 196",
        "key_button_10": "adb shell input keyevent 197",
        "key_button_11": "adb shell input keyevent 198",
        "key_button_12": "adb shell input keyevent 199",
        "key_button_13": "adb shell input keyevent 200",
        "key_button_14": "adb shell input keyevent 201",
        "key_button_15": "adb shell input keyevent 202",
        "key_button_16": "adb shell input keyevent 203",
        "key_language_switch": "adb shell input keyevent 204",
        "key_manner_mode": "adb shell input keyevent 205",
        "key_3d_mode": "adb shell input keyevent 206",
        "key_contacts": "adb shell input keyevent 207",
        "key_calendar": "adb shell input keyevent 208",
        "key_music": "adb shell input keyevent 209",
        "key_calculator": "adb shell input keyevent 210",
        "key_zenkaku_hankaku": "adb shell input keyevent 211",
        "key_eisu": "adb shell input keyevent 212",
        "key_muhenkan": "adb shell input keyevent 213",
        "key_henkan": "adb shell input keyevent 214",
        "key_katakana_hiragana": "adb shell input keyevent 215",
        "key_yen": "adb shell input keyevent 216",
        "key_ro": "adb shell input keyevent 217",
        "key_kana": "adb shell input keyevent 218",
        "key_assist": "adb shell input keyevent 219",
        "key_brightness_down": "adb shell input keyevent 220",
        "key_brightness_up": "adb shell input keyevent 221",
        "key_media_audio_track": "adb shell input keyevent 222",
        "key_sleep": "adb shell input keyevent 223",
        "key_wakeup": "adb shell input keyevent 224",
        "key_pairing": "adb shell input keyevent 225",
        "key_media_top_menu": "adb shell input keyevent 226",
        "key_11": "adb shell input keyevent 227",
        "key_12": "adb shell input keyevent 228",
        "key_last_channel": "adb shell input keyevent 229",
        "key_tv_data_service": "adb shell input keyevent 230",
        "key_voice_assist": "adb shell input keyevent 231",
        "key_tv_radio_service": "adb shell input keyevent 232",
        "key_tv_teletext": "adb shell input keyevent 233",
        "key_tv_number_entry": "adb shell input keyevent 234",
        "key_tv_terrestrial_analog": "adb shell input keyevent 235",
        "key_tv_terrestrial_digital": "adb shell input keyevent 236",
        "key_tv_satellite": "adb shell input keyevent 237",
        "key_tv_satellite_bs": "adb shell input keyevent 238",
        "key_tv_satellite_cs": "adb shell input keyevent 239",
        "key_tv_satellite_service": "adb shell input keyevent 240",
        "key_tv_network": "adb shell input keyevent 241",
        "key_tv_antenna_cable": "adb shell input keyevent 242",
        "key_tv_input_hdmi_1": "adb shell input keyevent 243",
        "key_tv_input_hdmi_2": "adb shell input keyevent 244",
        "key_tv_input_hdmi_3": "adb shell input keyevent 245",
        "key_tv_input_hdmi_4": "adb shell input keyevent 246",
        "key_tv_input_composite_1": "adb shell input keyevent 247",
        "key_tv_input_composite_2": "adb shell input keyevent 248",
        "key_tv_input_component_1": "adb shell input keyevent 249",
        "key_tv_input_component_2": "adb shell input keyevent 250",
        "key_tv_input_vga_1": "adb shell input keyevent 251",
        "key_tv_audio_description": "adb shell input keyevent 252",
        "key_tv_audio_description_mix_up": "adb shell input keyevent 253",
        "key_tv_audio_description_mix_down": "adb shell input keyevent 254",
        "key_tv_zoom_mode": "adb shell input keyevent 255",
        "key_tv_contents_menu": "adb shell input keyevent 256",
        "key_tv_media_context_menu": "adb shell input keyevent 257",
        "key_tv_timer_programming": "adb shell input keyevent 258",
        "key_help": "adb shell input keyevent 259",
        "key_navigate_previous": "adb shell input keyevent 260",
        "key_navigate_next": "adb shell input keyevent 261",
        "key_navigate_in": "adb shell input keyevent 262",
        "key_navigate_out": "adb shell input keyevent 263",
        "key_stem_primary": "adb shell input keyevent 264",
        "key_stem_1": "adb shell input keyevent 265",
        "key_stem_2": "adb shell input keyevent 266",
        "key_stem_3": "adb shell input keyevent 267",
        "key_dpad_up_left": "adb shell input keyevent 268",
        "key_dpad_down_left": "adb shell input keyevent 269",
        "key_dpad_up_right": "adb shell input keyevent 270",
        "key_dpad_down_right": "adb shell input keyevent 271",
        "key_media_skip_forward": "adb shell input keyevent 272",
        "key_media_skip_backward": "adb shell input keyevent 273",
        "key_media_step_forward": "adb shell input keyevent 274",
        "key_media_step_backward": "adb shell input keyevent 275",
        "key_soft_sleep": "adb shell input keyevent 276",
        "key_cut": "adb shell input keyevent 277",
        "key_copy": "adb shell input keyevent 278",
        "key_paste": "adb shell input keyevent 279",
        "key_system_navigation_up": "adb shell input keyevent 280",
        "key_system_navigation_down": "adb shell input keyevent 281",
        "key_system_navigation_left": "adb shell input keyevent 282",
        "key_system_navigation_right": "adb shell input keyevent 283",
        "key_all_apps": "adb shell input keyevent 284",
        "key_refresh": "adb shell input keyevent 285"
    }
}

Ref. repo: ADB Automate Android Phone

{    
    "key_events": {
        "key_unknown": "adb shell input keyevent 0",
        "key_soft_left": "adb shell input keyevent 1",
        "key_soft_right": "adb shell input keyevent 2",
        "key_home": "adb shell input keyevent 3",
        "key_back": "adb shell input keyevent 4",
        "key_call": "adb shell input keyevent 5",
        "key_endcall": "adb shell input keyevent 6",
        "key_0": "adb shell input keyevent 7",
        "key_1": "adb shell input keyevent 8",
        "key_2": "adb shell input keyevent 9",
        "key_3": "adb shell input keyevent 10",
        "key_4": "adb shell input keyevent 11",
        "key_5": "adb shell input keyevent 12",
        "key_6": "adb shell input keyevent 13",
        "key_7": "adb shell input keyevent 14",
        "key_8": "adb shell input keyevent 15",
        "key_9": "adb shell input keyevent 16",
        "key_star": "adb shell input keyevent 17",
        "key_pound": "adb shell input keyevent 18",
        "key_dpad_up": "adb shell input keyevent 19",
        "key_dpad_down": "adb shell input keyevent 20",
        "key_dpad_left": "adb shell input keyevent 21",
        "key_dpad_right": "adb shell input keyevent 22",
        "key_dpad_center": "adb shell input keyevent 23",
        "key_volume_up": "adb shell input keyevent 24",
        "key_volume_down": "adb shell input keyevent 25",
        "key_power": "adb shell input keyevent 26",
        "key_camera": "adb shell input keyevent 27",
        "key_clear": "adb shell input keyevent 28",
        "key_a": "adb shell input keyevent 29",
        "key_b": "adb shell input keyevent 30",
        "key_c": "adb shell input keyevent 31",
        "key_d": "adb shell input keyevent 32",
        "key_e": "adb shell input keyevent 33",
        "key_f": "adb shell input keyevent 34",
        "key_g": "adb shell input keyevent 35",
        "key_h": "adb shell input keyevent 36",
        "key_i": "adb shell input keyevent 37",
        "key_j": "adb shell input keyevent 38",
        "key_k": "adb shell input keyevent 39",
        "key_l": "adb shell input keyevent 40",
        "key_m": "adb shell input keyevent 41",
        "key_n": "adb shell input keyevent 42",
        "key_o": "adb shell input keyevent 43",
        "key_p": "adb shell input keyevent 44",
        "key_q": "adb shell input keyevent 45",
        "key_r": "adb shell input keyevent 46",
        "key_s": "adb shell input keyevent 47",
        "key_t": "adb shell input keyevent 48",
        "key_u": "adb shell input keyevent 49",
        "key_v": "adb shell input keyevent 50",
        "key_w": "adb shell input keyevent 51",
        "key_x": "adb shell input keyevent 52",
        "key_y": "adb shell input keyevent 53",
        "key_z": "adb shell input keyevent 54",
        "key_comma": "adb shell input keyevent 55",
        "key_period": "adb shell input keyevent 56",
        "key_alt_left": "adb shell input keyevent 57",
        "key_alt_right": "adb shell input keyevent 58",
        "key_shift_left": "adb shell input keyevent 59",
        "key_shift_right": "adb shell input keyevent 60",
        "key_tab": "adb shell input keyevent 61",
        "key_space": "adb shell input keyevent 62",
        "key_sym": "adb shell input keyevent 63",
        "key_explorer": "adb shell input keyevent 64",
        "key_envelope": "adb shell input keyevent 65",
        "key_enter": "adb shell input keyevent 66",
        "key_del": "adb shell input keyevent 67",
        "key_grave": "adb shell input keyevent 68",
        "key_minus": "adb shell input keyevent 69",
        "key_equals": "adb shell input keyevent 70",
        "key_left_bracket": "adb shell input keyevent 71",
        "key_right_bracket": "adb shell input keyevent 72",
        "key_backslash": "adb shell input keyevent 73",
        "key_semicolon": "adb shell input keyevent 74",
        "key_apostrophe": "adb shell input keyevent 75",
        "key_slash": "adb shell input keyevent 76",
        "key_at": "adb shell input keyevent 77",
        "key_num": "adb shell input keyevent 78",
        "key_headsethook": "adb shell input keyevent 79",
        "key_focus": "adb shell input keyevent 80",
        "key_plus": "adb shell input keyevent 81",
        "key_menu": "adb shell input keyevent 82",
        "key_notification": "adb shell input keyevent 83",
        "key_search": "adb shell input keyevent 84",
        "key_media_play_pause": "adb shell input keyevent 85",
        "key_media_stop": "adb shell input keyevent 86",
        "key_media_next": "adb shell input keyevent 87",
        "key_media_previous": "adb shell input keyevent 88",
        "key_media_rewind": "adb shell input keyevent 89",
        "key_media_fast_forward": "adb shell input keyevent 90",
        "key_mute": "adb shell input keyevent 91",
        "key_page_up": "adb shell input keyevent 92",
        "key_page_down": "adb shell input keyevent 93",
        "key_pictsymbols": "adb shell input keyevent 94",
        "key_switch_charset": "adb shell input keyevent 95",
        "key_button_a": "adb shell input keyevent 96",
        "key_button_b": "adb shell input keyevent 97",
        "key_button_c": "adb shell input keyevent 98",
        "key_button_x": "adb shell input keyevent 99",
        "key_button_y": "adb shell input keyevent 100",
        "key_button_z": "adb shell input keyevent 101",
        "key_button_l1": "adb shell input keyevent 102",
        "key_button_r1": "adb shell input keyevent 103",
        "key_button_l2": "adb shell input keyevent 104",
        "key_button_r2": "adb shell input keyevent 105",
        "key_button_thumbl": "adb shell input keyevent 106",
        "key_button_thumbr": "adb shell input keyevent 107",
        "key_button_start": "adb shell input keyevent 108",
        "key_button_select": "adb shell input keyevent 109",
        "key_button_mode": "adb shell input keyevent 110",
        "key_escape": "adb shell input keyevent 111",
        "key_forward_del": "adb shell input keyevent 112",
        "key_ctrl_left": "adb shell input keyevent 113",
        "key_ctrl_right": "adb shell input keyevent 114",
        "key_caps_lock": "adb shell input keyevent 115",
        "key_scroll_lock": "adb shell input keyevent 116",
        "key_meta_left": "adb shell input keyevent 117",
        "key_meta_right": "adb shell input keyevent 118",
        "key_function": "adb shell input keyevent 119",
        "key_sysrq": "adb shell input keyevent 120",
        "key_break": "adb shell input keyevent 121",
        "key_move_home": "adb shell input keyevent 122",
        "key_move_end": "adb shell input keyevent 123",
        "key_insert": "adb shell input keyevent 124",
        "key_forward": "adb shell input keyevent 125",
        "key_media_play": "adb shell input keyevent 126",
        "key_media_pause": "adb shell input keyevent 127",
        "key_media_close": "adb shell input keyevent 128",
        "key_media_eject": "adb shell input keyevent 129",
        "key_media_record": "adb shell input keyevent 130",
        "key_f1": "adb shell input keyevent 131",
        "key_f2": "adb shell input keyevent 132",
        "key_f3": "adb shell input keyevent 133",
        "key_f4": "adb shell input keyevent 134",
        "key_f5": "adb shell input keyevent 135",
        "key_f6": "adb shell input keyevent 136",
        "key_f7": "adb shell input keyevent 137",
        "key_f8": "adb shell input keyevent 138",
        "key_f9": "adb shell input keyevent 139",
        "key_f10": "adb shell input keyevent 140",
        "key_f11": "adb shell input keyevent 141",
        "key_f12": "adb shell input keyevent 142",
        "key_num_lock": "adb shell input keyevent 143",
        "key_numpad_0": "adb shell input keyevent 144",
        "key_numpad_1": "adb shell input keyevent 145",
        "key_numpad_2": "adb shell input keyevent 146",
        "key_numpad_3": "adb shell input keyevent 147",
        "key_numpad_4": "adb shell input keyevent 148",
        "key_numpad_5": "adb shell input keyevent 149",
        "key_numpad_6": "adb shell input keyevent 150",
        "key_numpad_7": "adb shell input keyevent 151",
        "key_numpad_8": "adb shell input keyevent 152",
        "key_numpad_9": "adb shell input keyevent 153",
        "key_numpad_divide": "adb shell input keyevent 154",
        "key_numpad_multiply": "adb shell input keyevent 155",
        "key_numpad_subtract": "adb shell input keyevent 156",
        "key_numpad_add": "adb shell input keyevent 157",
        "key_numpad_dot": "adb shell input keyevent 158",
        "key_numpad_comma": "adb shell input keyevent 159",
        "key_numpad_enter": "adb shell input keyevent 160",
        "key_numpad_equals": "adb shell input keyevent 161",
        "key_numpad_left_paren": "adb shell input keyevent 162",
        "key_numpad_right_paren": "adb shell input keyevent 163",
        "key_volume_mute": "adb shell input keyevent 164",
        "key_info": "adb shell input keyevent 165",
        "key_channel_up": "adb shell input keyevent 166",
        "key_channel_down": "adb shell input keyevent 167",
        "key_zoom_in": "adb shell input keyevent 168",
        "key_zoom_out": "adb shell input keyevent 169",
        "key_tv": "adb shell input keyevent 170",
        "key_window": "adb shell input keyevent 171",
        "key_guide": "adb shell input keyevent 172",
        "key_dvr": "adb shell input keyevent 173",
        "key_bookmark": "adb shell input keyevent 174",
        "key_captions": "adb shell input keyevent 175",
        "key_settings": "adb shell input keyevent 176",
        "key_tv_power": "adb shell input keyevent 177",
        "key_tv_input": "adb shell input keyevent 178",
        "key_stb_power": "adb shell input keyevent 179",
        "key_stb_input": "adb shell input keyevent 180",
        "key_avr_power": "adb shell input keyevent 181",
        "key_avr_input": "adb shell input keyevent 182",
        "key_prog_red": "adb shell input keyevent 183",
        "key_prog_green": "adb shell input keyevent 184",
        "key_prog_yellow": "adb shell input keyevent 185",
        "key_prog_blue": "adb shell input keyevent 186",
        "key_app_switch": "adb shell input keyevent 187",
        "key_button_1": "adb shell input keyevent 188",
        "key_button_2": "adb shell input keyevent 189",
        "key_button_3": "adb shell input keyevent 190",
        "key_button_4": "adb shell input keyevent 191",
        "key_button_5": "adb shell input keyevent 192",
        "key_button_6": "adb shell input keyevent 193",
        "key_button_7": "adb shell input keyevent 194",
        "key_button_8": "adb shell input keyevent 195",
        "key_button_9": "adb shell input keyevent 196",
        "key_button_10": "adb shell input keyevent 197",
        "key_button_11": "adb shell input keyevent 198",
        "key_button_12": "adb shell input keyevent 199",
        "key_button_13": "adb shell input keyevent 200",
        "key_button_14": "adb shell input keyevent 201",
        "key_button_15": "adb shell input keyevent 202",
        "key_button_16": "adb shell input keyevent 203",
        "key_language_switch": "adb shell input keyevent 204",
        "key_manner_mode": "adb shell input keyevent 205",
        "key_3d_mode": "adb shell input keyevent 206",
        "key_contacts": "adb shell input keyevent 207",
        "key_calendar": "adb shell input keyevent 208",
        "key_music": "adb shell input keyevent 209",
        "key_calculator": "adb shell input keyevent 210",
        "key_zenkaku_hankaku": "adb shell input keyevent 211",
        "key_eisu": "adb shell input keyevent 212",
        "key_muhenkan": "adb shell input keyevent 213",
        "key_henkan": "adb shell input keyevent 214",
        "key_katakana_hiragana": "adb shell input keyevent 215",
        "key_yen": "adb shell input keyevent 216",
        "key_ro": "adb shell input keyevent 217",
        "key_kana": "adb shell input keyevent 218",
        "key_assist": "adb shell input keyevent 219",
        "key_brightness_down": "adb shell input keyevent 220",
        "key_brightness_up": "adb shell input keyevent 221",
        "key_media_audio_track": "adb shell input keyevent 222",
        "key_sleep": "adb shell input keyevent 223",
        "key_wakeup": "adb shell input keyevent 224",
        "key_pairing": "adb shell input keyevent 225",
        "key_media_top_menu": "adb shell input keyevent 226",
        "key_11": "adb shell input keyevent 227",
        "key_12": "adb shell input keyevent 228",
        "key_last_channel": "adb shell input keyevent 229",
        "key_tv_data_service": "adb shell input keyevent 230",
        "key_voice_assist": "adb shell input keyevent 231",
        "key_tv_radio_service": "adb shell input keyevent 232",
        "key_tv_teletext": "adb shell input keyevent 233",
        "key_tv_number_entry": "adb shell input keyevent 234",
        "key_tv_terrestrial_analog": "adb shell input keyevent 235",
        "key_tv_terrestrial_digital": "adb shell input keyevent 236",
        "key_tv_satellite": "adb shell input keyevent 237",
        "key_tv_satellite_bs": "adb shell input keyevent 238",
        "key_tv_satellite_cs": "adb shell input keyevent 239",
        "key_tv_satellite_service": "adb shell input keyevent 240",
        "key_tv_network": "adb shell input keyevent 241",
        "key_tv_antenna_cable": "adb shell input keyevent 242",
        "key_tv_input_hdmi_1": "adb shell input keyevent 243",
        "key_tv_input_hdmi_2": "adb shell input keyevent 244",
        "key_tv_input_hdmi_3": "adb shell input keyevent 245",
        "key_tv_input_hdmi_4": "adb shell input keyevent 246",
        "key_tv_input_composite_1": "adb shell input keyevent 247",
        "key_tv_input_composite_2": "adb shell input keyevent 248",
        "key_tv_input_component_1": "adb shell input keyevent 249",
        "key_tv_input_component_2": "adb shell input keyevent 250",
        "key_tv_input_vga_1": "adb shell input keyevent 251",
        "key_tv_audio_description": "adb shell input keyevent 252",
        "key_tv_audio_description_mix_up": "adb shell input keyevent 253",
        "key_tv_audio_description_mix_down": "adb shell input keyevent 254",
        "key_tv_zoom_mode": "adb shell input keyevent 255",
        "key_tv_contents_menu": "adb shell input keyevent 256",
        "key_tv_media_context_menu": "adb shell input keyevent 257",
        "key_tv_timer_programming": "adb shell input keyevent 258",
        "key_help": "adb shell input keyevent 259",
        "key_navigate_previous": "adb shell input keyevent 260",
        "key_navigate_next": "adb shell input keyevent 261",
        "key_navigate_in": "adb shell input keyevent 262",
        "key_navigate_out": "adb shell input keyevent 263",
        "key_stem_primary": "adb shell input keyevent 264",
        "key_stem_1": "adb shell input keyevent 265",
        "key_stem_2": "adb shell input keyevent 266",
        "key_stem_3": "adb shell input keyevent 267",
        "key_dpad_up_left": "adb shell input keyevent 268",
        "key_dpad_down_left": "adb shell input keyevent 269",
        "key_dpad_up_right": "adb shell input keyevent 270",
        "key_dpad_down_right": "adb shell input keyevent 271",
        "key_media_skip_forward": "adb shell input keyevent 272",
        "key_media_skip_backward": "adb shell input keyevent 273",
        "key_media_step_forward": "adb shell input keyevent 274",
        "key_media_step_backward": "adb shell input keyevent 275",
        "key_soft_sleep": "adb shell input keyevent 276",
        "key_cut": "adb shell input keyevent 277",
        "key_copy": "adb shell input keyevent 278",
        "key_paste": "adb shell input keyevent 279",
        "key_system_navigation_up": "adb shell input keyevent 280",
        "key_system_navigation_down": "adb shell input keyevent 281",
        "key_system_navigation_left": "adb shell input keyevent 282",
        "key_system_navigation_right": "adb shell input keyevent 283",
        "key_all_apps": "adb shell input keyevent 284",
        "key_refresh": "adb shell input keyevent 285"
    }
}
月野兔 2024-12-17 10:11:07

向在 Android 设备中运行的 React-Native 应用发送重新加载调用:adb shell 输入键盘文本“rr”

To send a reload call to a React-Native app running in a android device: adb shell input keyboard text "rr"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文