Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ADB: Simulate Recent App key press

Tags:

android

adb

Is there a way to get the use ADB to simulate a Recent App key press? I do not see it in the list of assigned keys and I am not able to select it using adb input shell tap despite getting the coordinates from the debugging options.

I am trying to automate a task on my own personal phone (Nexus 5 with soft keys) so any hacky way is fine, assuming there is not a clean way to do this.

like image 802
UserIsStuck Avatar asked Nov 08 '14 20:11

UserIsStuck


2 Answers

The solution is to use the KEYCODE_APP_SWITCH KeyEvent:

adb shell input keyevent KEYCODE_APP_SWITCH
like image 149
Simon Marquis Avatar answered Oct 20 '22 00:10

Simon Marquis


See @SimonMarquis answer below

adb shell input keyevent KEYCODE_APP_SWITCH

(OBSOLETE)

I don't think there is a keycode for it.

However, I am able to open the recent apps menu with adb shell input tap (testing on a Nexus 5 with Lollipop). For example:

adb shell input tap 800 1890
like image 16
matiash Avatar answered Oct 20 '22 00:10

matiash