Amelia@Amazon avatar image
Amelia@Amazon posted

ActivityManager.AppTask has been Deprecated to Improve Security   


As of Android 5(API level 21), ActivityManager#getRunningTasks ( and ActivityManager#getRecentTasks (,%20int%29) methods of ActivityManager ( class are deprecated. Prior to Android 5, these methods used to return all tasks that included outside of the caller's app, which Google decided to deprecate to improve user privacy. For backwards compatibility, these methods still return small subset of tasks which includes caller's own tasks and non-sensitive tasks such as home task.


Unfortunately existing task switcher genre apps that use these methods to show background running apps and switch the app to foreground have no alternate way to accomplish this from Android 5. If the app uses these methods to retrieve it's own tasks, you should use ActivityManager#getAppTasks ( to retrieve that information. Also you can use ActivityManager#getRunningAppProcesses ( to retrieve application processes that are running on the device.

Comment from Google can be seen here:

Keywords: Deprecated Methods, AppTask, Task Switching


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.



rossbria contributed to this article brizzlebrazzle contributed to this article