ActivityManager.GetRunningTasks(Int32) 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("getRunningTasks", "(I)Ljava/util/List;", "GetGetRunningTasks_IHandler")]
[System.Obsolete("deprecated")]
public virtual System.Collections.Generic.IList<Android.App.ActivityManager.RunningTaskInfo>? GetRunningTasks(int maxNum);
[<Android.Runtime.Register("getRunningTasks", "(I)Ljava/util/List;", "GetGetRunningTasks_IHandler")>]
[<System.Obsolete("deprecated")>]
abstract member GetRunningTasks : int -> System.Collections.Generic.IList<Android.App.ActivityManager.RunningTaskInfo>
override this.GetRunningTasks : int -> System.Collections.Generic.IList<Android.App.ActivityManager.RunningTaskInfo>
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.
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 person information to the caller. For backwards compatibility, it will still return a small subset of its data: at least the caller's own tasks, and possibly some other tasks such as home that are known to not be sensitive.
Return a list of the tasks that are currently running, with the most recent being first and older ones after in order. Note that "running" does not mean any of the task's code is currently loaded or activity -- the task may have been frozen by the system, so that it can be restarted in its previous state when next brought to the foreground. 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.getRunningTasks.
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.