简体   繁体   中英

How can I get screenshot's from “Recent opened apps”?

Is possible to get full app screenshot from "Recent opened apps"?
I want to make MeeGo or Symbian similar task manager for Android.

Symbian Belle任务切换器

I doubt this is possible without running on a rooted phone.

The system recent tasks panel gets the thumbnails via this code:

final ActivityManager am = (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.TaskThumbnails thumbs = am.getTaskThumbnails(td.persistentTaskId);

But it seems getTaskThumbnails is a private method and only allowed to be accessed with system privileges.

Source: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/com/android/systemui/recent/RecentTasksLoader.java#RecentTasksLoader

Another option would be to use ActivityManager.getRunningTaks() to get the list of running tasks, then use RunningTaskInfo.thumbnail to get a thumbnail of the app. However, it seems that always returns null.

You could get the list of running tasks using AvtivityManager.getRunningTasks and use this to take the screenshots. Refer this project: http://androidexample.com/Check_Current_Running_Activity_%7C_Task_%7C_Application_-_Android_Example/index.php?view=article_discription&aid=111&aaid=133

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM