问题
Is possible to get full app screenshot from "Recent opened apps"?
I want to make MeeGo or Symbian similar task manager for Android.
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/21796543/how-can-i-get-screenshots-from-recent-opened-apps