Advertisement
metalx1000

Android sendkeys notes

Jun 22nd, 2014
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. #send button presses
  2. adb shell input keyevent 26 #power button
  3. adb shell input keyevent 3 #home
  4.  
  5. #send strings
  6. adb shell input text 'Hello%sWorld'
  7.  
  8.  
  9. ##volume loop from shell
  10. for i in `busybox seq 1 10`
  11. do input keyevent '24' & echo "volume up!"
  12. done
  13.  
  14.  
  15. for i in `busybox seq 1 10`
  16. do input keyevent '25' & echo "volume down!"
  17. done
  18.  
  19. #####################event codes for button presses#############
  20. 0 --> "KEYCODE_UNKNOWN"
  21. 1 --> "KEYCODE_MENU"
  22. 2 --> "KEYCODE_SOFT_RIGHT"
  23. 3 --> "KEYCODE_HOME"
  24. 4 --> "KEYCODE_BACK"
  25. 5 --> "KEYCODE_CALL"
  26. 6 --> "KEYCODE_ENDCALL"
  27. 7 --> "KEYCODE_0"
  28. 8 --> "KEYCODE_1"
  29. 9 --> "KEYCODE_2"
  30. 10 --> "KEYCODE_3"
  31. 11 --> "KEYCODE_4"
  32. 12 --> "KEYCODE_5"
  33. 13 --> "KEYCODE_6"
  34. 14 --> "KEYCODE_7"
  35. 15 --> "KEYCODE_8"
  36. 16 --> "KEYCODE_9"
  37. 17 --> "KEYCODE_STAR"
  38. 18 --> "KEYCODE_POUND"
  39. 19 --> "KEYCODE_DPAD_UP"
  40. 20 --> "KEYCODE_DPAD_DOWN"
  41. 21 --> "KEYCODE_DPAD_LEFT"
  42. 22 --> "KEYCODE_DPAD_RIGHT"
  43. 23 --> "KEYCODE_DPAD_CENTER"
  44. 24 --> "KEYCODE_VOLUME_UP"
  45. 25 --> "KEYCODE_VOLUME_DOWN"
  46. 26 --> "KEYCODE_POWER"
  47. 27 --> "KEYCODE_CAMERA"
  48. 28 --> "KEYCODE_CLEAR"
  49. 29 --> "KEYCODE_A"
  50. 30 --> "KEYCODE_B"
  51. 31 --> "KEYCODE_C"
  52. 32 --> "KEYCODE_D"
  53. 33 --> "KEYCODE_E"
  54. 34 --> "KEYCODE_F"
  55. 35 --> "KEYCODE_G"
  56. 36 --> "KEYCODE_H"
  57. 37 --> "KEYCODE_I"
  58. 38 --> "KEYCODE_J"
  59. 39 --> "KEYCODE_K"
  60. 40 --> "KEYCODE_L"
  61. 41 --> "KEYCODE_M"
  62. 42 --> "KEYCODE_N"
  63. 43 --> "KEYCODE_O"
  64. 44 --> "KEYCODE_P"
  65. 45 --> "KEYCODE_Q"
  66. 46 --> "KEYCODE_R"
  67. 47 --> "KEYCODE_S"
  68. 48 --> "KEYCODE_T"
  69. 49 --> "KEYCODE_U"
  70. 50 --> "KEYCODE_V"
  71. 51 --> "KEYCODE_W"
  72. 52 --> "KEYCODE_X"
  73. 53 --> "KEYCODE_Y"
  74. 54 --> "KEYCODE_Z"
  75. 55 --> "KEYCODE_COMMA"
  76. 56 --> "KEYCODE_PERIOD"
  77. 57 --> "KEYCODE_ALT_LEFT"
  78. 58 --> "KEYCODE_ALT_RIGHT"
  79. 59 --> "KEYCODE_SHIFT_LEFT"
  80. 60 --> "KEYCODE_SHIFT_RIGHT"
  81. 61 --> "KEYCODE_TAB"
  82. 62 --> "KEYCODE_SPACE"
  83. 63 --> "KEYCODE_SYM"
  84. 64 --> "KEYCODE_EXPLORER"
  85. 65 --> "KEYCODE_ENVELOPE"
  86. 66 --> "KEYCODE_ENTER"
  87. 67 --> "KEYCODE_DEL"
  88. 68 --> "KEYCODE_GRAVE"
  89. 69 --> "KEYCODE_MINUS"
  90. 70 --> "KEYCODE_EQUALS"
  91. 71 --> "KEYCODE_LEFT_BRACKET"
  92. 72 --> "KEYCODE_RIGHT_BRACKET"
  93. 73 --> "KEYCODE_BACKSLASH"
  94. 74 --> "KEYCODE_SEMICOLON"
  95. 75 --> "KEYCODE_APOSTROPHE"
  96. 76 --> "KEYCODE_SLASH"
  97. 77 --> "KEYCODE_AT"
  98. 78 --> "KEYCODE_NUM"
  99. 79 --> "KEYCODE_HEADSETHOOK"
  100. 80 --> "KEYCODE_FOCUS"
  101. 81 --> "KEYCODE_PLUS"
  102. 82 --> "KEYCODE_MENU"
  103. 83 --> "KEYCODE_NOTIFICATION"
  104. 84 --> "KEYCODE_SEARCH"
  105. 85 --> "TAG_LAST_KEYCODE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement