0

I want to create something like a taskkiller and for that I need the running apps. I tried it like this:

ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
            List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(Integer.MAX_VALUE);
            for (int i = 0; i < taskInfo.size(); i++) {
                ComponentName componentInfo = taskInfo.get(i).topActivity;
                if(!componentInfo.getPackageName().equals("xxx")) {
                    Log.v(TAG, "Package: " + componentInfo.getPackageName());
                }
            }

But I only get my active application not all active ones :/

Where is the mistake?

Permission is set.

Phil
  • 57
  • 8
  • my code isexactly the same like in this threads?! the problem is that I only get my application, not ALL runnings, like I wrote above – Phil Jul 21 '13 at 15:44
  • Can you edit your question to include your output and the expected result? – boxed__l Jul 21 '13 at 15:52
  • Sorry but my output is empty because it only finds my application and the if excludes my app from being logged, my expected result is to put out log for every running application (running = like I press and hold home button, multitasking or what its called) – Phil Jul 21 '13 at 15:54

0 Answers0