UserIsStuck
UserIsStuck

Reputation: 529

Android ADB: Simulate Recent App key press

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.

Upvotes: 19

Views: 18557

Answers (3)

adb shell input keyevent KEYCODE_APP_SWITCH

Still works, you don't even have to put its numeric value (187) into the command.

Upvotes: 1

matiash
matiash

Reputation: 55360

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

Upvotes: 16

Simon Marquis
Simon Marquis

Reputation: 7526

The solution is to use the KEYCODE_APP_SWITCH KeyEvent:

adb shell input keyevent KEYCODE_APP_SWITCH

Upvotes: 32

Related Questions