java - getRunningAppProcesses() returns only my app -
i use method running app processes in background
list = new arraylist<appprocessinfo>(); applicationinfo appinfo = null; appprocessinfo abappprocessinfo = null; list<activitymanager.runningappprocessinfo> appprocesslist = activitymanager .getrunningappprocesses(); // publishprogress(0, appprocesslist.size()); (activitymanager.runningappprocessinfo appprocessinfo : appprocesslist) { // publishprogress(++mappcount, appprocesslist.size()); abappprocessinfo = new appprocessinfo( appprocessinfo.processname, appprocessinfo.pid, appprocessinfo.uid); try { appinfo = packagemanager.getapplicationinfo(appprocessinfo.processname, 0); ........................... .............................
but when run application in device ( android 6.0 ) app process can modify function work see https://github.com/jaredrummler/androidprocesses don't know how use because use different structure in function?
i use library https://github.com/jaredrummler/androidprocesses/ , update code
list = new arraylist<appprocessinfo>(); applicationinfo appinfo = null; appprocessinfo abappprocessinfo = null; list<activitymanager.runningappprocessinfo> appprocesslist = activitymanager .getrunningappprocesses(); // publishprogress(0, appprocesslist.size()); list<androidappprocess> processes = androidprocesses.getrunningappprocesses(); (androidappprocess appprocessinfo : processes) { string processname = appprocessinfo.name; stat stat = null; try { stat = appprocessinfo.stat(); } catch (ioexception e) { e.printstacktrace(); } abappprocessinfo = new appprocessinfo( appprocessinfo.name, stat.getpid(), appprocessinfo.uid); try { appinfo = appprocessinfo.getpackageinfo(mcontext, 0).applicationinfo; .........................
it's working thank
Comments
Post a Comment