hello this is joã£o dias, creator of the autoapps. today i'm going to show you how to kill arunning app on your android device, without the need to root it. to do this, we're going to need autoinput,autoshare and autolaunch as well as tasker, of course. with autoinput, you can automatically clickapp buttons amongst many other things. i'll leave the link to the autoinput video in thevideo description. to kill an app, first we're going to launchthe android app configuration screen for the app we want to kill, and then we'll clickthe force stop button there with autoinput
and effectively kill the app. to start, create a new task in tasker andcall it "kill app" as always, i like to start my tasks with aflash action, just so i'm sure it's running properly. so, add a flash action, and in thetext write "killing app %app". the %app variable is not created yet, but for now let's assumethat it has the name of the app you want to kill. we'll give a value later. to launch the app configuration screen i mentionedearlier, we need the package name for the app. the package name is a unique name foran app. no 2 apps can have the same package name. you can easily check the package namefor an app on google play by looking at the
url of an app's page. the part at the endthere is the package name. so, to get the package name we're going to use the autolaunchquery action. you give it the app name and it retrieves the package name for it. ok, so now that we have the package name thenext step is to launch the app configuration screen. to do this, we're going to use anautoshare action. add the action and then touch the "get more intents" option. we needto import the intent that allows us to launch the app configuration screen like we wantto. scroll all the way down to the bottom and there you'll find the "open app settings"intent. click on that and it'll import it into autoshare. press back so you go backto autoshare.
you can now find the intent you just importedwhen selecting the "android" app above. if you now go to the "advanced" settings andselect "data", you'll notice that this intent uses a variable called %package which we didn'tcreate yet. this variable is supposed to contain the package name of the app you want to launchthe app settings screen of. we could just change the variable here, but instead, let'scopy the value we got from autolaunch into the %package variable. to do this, accept the autoshare settingsand go back to the task. now add a "variable set" action. we're going to create the %packagevariable and set it to %alpackages(1) value which we got from autolaunch. when you queryautolaunch you can get multiple results back,
so that's why the %alpackages is a list ofvalues (indicated by the parenthisis) and not just a single value. to get the firstvalue from the list just add the 1 there. ok, remember the %app variable from the beginningthat was supposed to contain the app name? let's set it to something temporarily justso we can test this. add a "variable set" action and set %app to"play music". this should now launch the app settings page for google play music. thereyou go. it works. as mentioned before we now want to click the"force stop" button on that screen. we'll do this with autoinput action. we want to click the button, so set actionto "click". we want to click a button with
a certain text, so set field type to "text".we want to click a button with the text "force stop", so let's write that here. accept these settings, go back to the taskand test that again. you'll now see that the app settings screen is opened and that thebutton is clicked. all you need to do now is to click the okbutton so that the app is stopped. go back to tasker and clone the autoinput action youjust created. in this new action we just need to change the text from "force stop" to "ok"and we're done. if you now test the task again, you'll seethat app is really closed. great! as a finishing touch we can do just one more thing. we canmake it go back to where we were, before opening
the app settings screen. to do that, simplyadd an autoinput global action and select the "back" action there. you'll see that thistime, when you test it, you'll end up in tasker. ok, great we have it working now. but howcan you use this in a real situation? how can the %app variable from the beginning havea real value depending on the situation you're in? well you can make this task usable fromany other task for starters. when you call a task from another task you can pass in acouple of parameters. the first of those parameters is stored in a variable called %par1. so ifthis task is called from another task, this variable will have a value. if not, it'llbe empty. so simply add a variable set action and set %app to %par1, but only if %par1 hasa value.
so, let's create another task called "killgoogle app". here, add a new "perform task" action. first select the other task we justcreated that's called "kill app", and then pass it the text "google app" as the firstparameter. this will set the %par1 variable to "google app" in the other task. one thing i forgot to do was exit tasker sothat the first task we created is saved. only then can it be called from another task. so,exit tasker, go back to the "kill google app" task and try it out. cool, so now you can kill any app from anytask with one simple step. as another example you can make use of autovoice if you wantand kill an app with your voice. simply use
the command filter shown here, don't forgetto enable regex, and as the task simply use the "kill app" task. since autovoice willcreate the %app variable for you, you don't need to worry about anything else. that's it for today. hope you enjoyed thevideo! let me know if you'd like more of these kinds of videos by leaving a comment downbelow. see you next time. and don't forget...