Monitoring app launches on android -
i need create app able check when other apps opened or closed ("on resume" or "on pause") on device. need check time of use of each app.
can without root access in device?
try code
activitymanager activitymanager = (activitymanager) this.getsystemservice( activity_service ); list<runningappprocessinfo> procinfos = actvitymanager.getrunningappprocesses(); for(int = 0; < procinfos.size(); i++){ if(procinfos.get(i).processname.equals("com.android.browser")) { toast.maketext(getapplicationcontext(), "browser running", toast.length_long).show(); } }
find package name using download package name viewer
https://play.google.com/store/apps/details?id=com.gijoon.pkgnameviewer&hl=en
Comments
Post a Comment