activity manager - How to kill background running apps in Android ? -
i want develop task-killer . task of app kill background running applications . have searched lot in internet , found following code kill installed application .
list<applicationinfo> packages; packagemanager pm; pm = getpackagemanager(); //get list of installed apps. packages = pm.getinstalledapplications(0); activitymanager mactivitymanager = (activitymanager)context.getsystemservice(context.activity_service); (applicationinfo packageinfo : packages) { if((packageinfo.flags & applicationinfo.flag_system)==1)continue; if(packageinfo.packagename.equals("mypackage")) continue; mactivitymanager.killbackgroundprocesses(packageinfo.packagename); }
but code kills installed applications . want kill apps running in background .i not want kill apps without android os shutdown . can me in purpose ?
Comments
Post a Comment