I need to get a list of running processes and their “state” (cached or primary at the moment, etc.).
Maybe through PackageManager and ApplicationInfo you can get the status. But that's how it is? Where to dig?
Found the answer.
// Get running processes ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); List<RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses(); if (runningProcesses != null && runningProcesses.size() > 0) { // Set data to the list adapter setListAdapter(new ListAdapter(this, runningProcesses)); } else { // In case there are no processes running (not a chance :)) Toast.makeText(getApplicationContext(), "No application is running", Toast.LENGTH_LONG).show(); } Source: https://ru.stackoverflow.com/questions/528667/
All Articles