Programming Tips - Android: get running processes

Date: 2021mar17 OS: Android Language: Java Q. Android: get running processes A. Its not possible to get all the running processes any more. But if you are able to system-sign your app and add:
<uses-permission android:name="android.permission.REAL_GET_TASKS"/>
In the manifest. You can do:
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Activity.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> apps = activityManager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo app : apps) { // Do something with app }