ActivityManager.GetRecentTasks(Int32, RecentTaskFlags) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
deprecated
This method was deprecated in API level 21.
[Android.Runtime.Register("getRecentTasks", "(II)Ljava/util/List;", "GetGetRecentTasks_IIHandler")]
[System.Obsolete("deprecated")]
public virtual System.Collections.Generic.IList<Android.App.ActivityManager.RecentTaskInfo>? GetRecentTasks(int maxNum, Android.App.RecentTaskFlags flags);
[<Android.Runtime.Register("getRecentTasks", "(II)Ljava/util/List;", "GetGetRecentTasks_IIHandler")>]
[<System.Obsolete("deprecated")>]
abstract member GetRecentTasks : int * Android.App.RecentTaskFlags -> System.Collections.Generic.IList<Android.App.ActivityManager.RecentTaskInfo>
override this.GetRecentTasks : int * Android.App.RecentTaskFlags -> System.Collections.Generic.IList<Android.App.ActivityManager.RecentTaskInfo>
Parameters
- maxNum
- Int32
int: The maximum number of entries to return in the list. The actual number returned may be smaller, depending on how many tasks the user has started and the maximum number the system can remember.
- flags
- RecentTaskFlags
int: Information about what to return. May be any combination of RECENT_WITH_EXCLUDED and RECENT_IGNORE_UNAVAILABLE.
Returns
- Attributes
Remarks
This method was deprecated in API level 21. As of Build.VERSION_CODES.LOLLIPOP, this method is no longer available to third party applications: the introduction of document-centric recents means it can leak personal information to the caller. For backwards compatibility, it will still return a small subset of its data: at least the caller's own tasks (though see getAppTasks() for the correct supported way to retrieve that information), and possibly some other tasks such as home that are known to not be sensitive.
Note: this method is only intended for debugging and presenting task management user interfaces. This should never be used for core logic in an application, such as deciding between different behaviors based on the information found here. Such uses are not supported, and will likely break in the future. For example, if multiple applications can be actively running at the same time, assumptions made about the meaning of the data here for purposes of control flow will be incorrect.
Throws: SecurityException
Android reference for android.app.ActivityManager.getRecentTasks.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.