开发者

ActivityManager.getRecentTasks() returns 0 results

开发者 https://www.devze.com 2023-04-09 13:10 出处:网络
update I\'ve tried this on a 1.6 AVD and a real Droid Incredible. Both have the same issue. I need to get a list of recent tasks, but ActivityManager.getRecentTasks() always returns 0 results and can

update I've tried this on a 1.6 AVD and a real Droid Incredible. Both have the same issue.

I need to get a list of recent tasks, but ActivityManager.getRecentTasks() always returns 0 results and can't figure out 开发者_如何学JAVAwhy.

ActivityManager result = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
ArrayList<RecentTaskInfo> apps = (ArrayList<RecentTaskInfo>) result.getRecentTasks(10, ActivityManager.RECENT_WITH_EXCLUDED);

I've set android.permission.GET_TASKS in the manifest but apps is always 0.

Anyone have insight in to why? I'm stumped.


Apparently it was that I needed to clean the project. Once I cleaned the project, it worked.

0

精彩评论

暂无评论...
验证码 换一张
取 消