I have been trying to get the number of applications currently running in the background using the following code:
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfo = am.getRunningAppProcesses();
int numberOfApps = runningAppProcessInfo.size();
But even though more than 1 application is running in the background the code is returning 1.