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

北城以北 提交于 2019-12-08 08:12:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!