Sample Header Ad - 728x90

How can I force-stop all user applications that are running?

3 votes
1 answer
3066 views
I found that first of all System>Apps>Running is not helpful always and secondly I we stop the services, it may star again if corresponding application is running. The correct way to stop application is **force stop**. (that's why ram booster may not helpful sufficiently). I've made an simple script that get the list of all user applications and then force-stop all one by one: pm list packages -3 -f | sed /jackpal.androidterm/d > /sdcard/tbs/app2fs while read -r line; do APK=$(echo $line | cut -d ':' -f2 | cut -d '=' -f1); PKG=$(echo $line | cut -d '=' -f2); echo "Forcing to Stop: $(aapt d badging $APK | grep "application: label" | cut -d "'" -f2)"; am force-stop $PKG; done < /sdcard/tbs/app2fs The draw back of above command is it tries to force-stops all (doesn't matter running or not) third-party applications. But I want to do am force-stop only for the running user apps. So, **How do I get the list of all running user apps (not services)?** You may have better way to do this than my script/command, hence broadly: **How can I force-stop all user applications that are running?** Note: I recommend the command-line solution. Because this type application (that can force-stop all running user apps) mostly runs constantly for monitoring which I don't like. If you've a suggestion for an app that can do such job and also favourable (should not run constantly for monitory) , then you can suggest it.
Asked by Pandya (477 rep)
Feb 21, 2016, 07:37 AM
Last activity: Sep 21, 2017, 01:54 PM