Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADB: How to tap/close from recent apps to completelty through ADB one liner command

I have tried multiple commands to close the app from App switcher but didn't through it. I even don't know if there is ány adb command which is persist to close the app from the app switcher. I more Googled for the same and even went through Android but no luck. Does anyone know about this, how to tackle? Kindly suggest our valuable inputs. Thanks in advance

like image 646
Vaibhav Joshi Avatar asked Nov 24 '15 15:11

Vaibhav Joshi


People also ask

How do I force quit an app using adb?

In Devices view you will find all running processes. Choose the process and click on Stop . It will kill only background process of an application. adb shell am kill [options] <PACKAGE> => Kill all processes associated with (the app's package name).

How do I end an adb session?

To exit adb and return to the system shell use the $q or $Q command. To stop the debugger press <Ctrl>D. NOTE: adb cannot be stopped by pressing the Quit or Interrupt key.

How do I launch an activity from adb?

You can use the start command from Activity Manager (am) a.k.a the adb shell am start -n command (via adb) specifying the app package name and the component name as defined in the manifest. You can add other parameters like ACTION (-a android. intent. action.


3 Answers

Finally, I got the answer when I tried combining multiple commands:

  1. Open the app switcher

    adb shell input keyevent KEYCODE_APP_SWITCH
    
  2. Select or navigate to the next app in the app switcher

    adb shell input keyevent 20
    ...
    

    (run the above command again for each app down the list)

  3. Remove the app from open app list

    adb shell input keyevent DEL
    

And you are done :-) the app gone out of your open apps list.

like image 123
Vaibhav Joshi Avatar answered Sep 29 '22 13:09

Vaibhav Joshi


android 5.0 and more

open recent apps

adb shell input keyevent KEYCODE_APP_SWITCH

select app

adb shell input keyevent KEYCODE_DPAD_DOWN

clear from recent apps

adb shell input keyevent DEL

like image 21
Mustafa SEN Avatar answered Sep 29 '22 13:09

Mustafa SEN


Thanks to @rilwan for the answer, below command worked for me: First enter into adb shell then execute:

$ adb shell
$ input keyevent KEYCODE_APP_SWITCH && input swipe 522 1647 522 90

or execute at once

$ adb shell input keyevent KEYCODE_APP_SWITCH && input swipe 522 1647 522 90
like image 39
HackRx Avatar answered Sep 29 '22 14:09

HackRx