ActivityManager Class
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.
This class gives information about, and interacts with, activities, services, and the containing process.
[Android.Runtime.Register("android/app/ActivityManager", DoNotGenerateAcw=true)]
public class ActivityManager : Java.Lang.Object
[<Android.Runtime.Register("android/app/ActivityManager", DoNotGenerateAcw=true)>]
type ActivityManager = class
inherit Object
- Inheritance
- Attributes
Remarks
This class gives information about, and interacts with, activities, services, and the containing process.
A number of the methods in this class are for debugging or informational purposes and they should not be used to affect any runtime behavior of your app. These methods are called out as such in the method level documentation.
Most application developers should not have the need to use this class, most of whose methods are for specialized use cases. However, a few methods are more broadly applicable. For instance, isLowRamDevice() enables your app to detect whether it is running on a low-memory device, and behave accordingly. clearApplicationUserData() is for apps with reset-data functionality.
In some special use cases, where an app interacts with its Task stack, the app may use the ActivityManager.AppTask and ActivityManager.RecentTaskInfo inner classes. However, in general, the methods in this class should be used for testing and debugging purposes only.
Android reference for android.app.ActivityManager.
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.
Constructors
| Name | Description |
|---|---|
| ActivityManager(IntPtr, JniHandleOwnership) |
Initializes a managed representation of an existing Java Native Interface object. |
Fields
| Name | Description |
|---|---|
| ActionReportHeapLimit |
Action an app can implement to handle reports from |
| MetaHomeAlternate |
<c><meta-data></c> name for a 'home' Activity that declares a package that is to be uninstalled in lieu of the declaring one. |
Properties
| Name | Description |
|---|---|
| AppTasks |
Get the list of tasks associated with the calling application. |
| AppTaskThumbnailSize |
Return the current design dimensions for |
| Class |
Returns the runtime class of this |
| DeviceConfigurationInfo |
Get the device configuration attributes. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| IsBackgroundRestricted |
Query whether the user has enabled background restrictions for this app. |
| IsInLockTaskMode |
Obsolete.
Return whether currently in lock task mode. |
| IsLowMemoryKillReportSupported |
See also: |
| IsLowRamDevice |
Returns true if this is a low-RAM device. |
| IsRunningInTestHarness |
Returns "true" if device is running in a test harness. |
| IsRunningInUserTestHarness |
Returns "true" if the device is running in Test Harness Mode. |
| IsUserAMonkey |
Returns "true" if the user interface is currently being messed with by a monkey. |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers |
Provides JNI binding infrastructure for Android.App.ActivityManager. |
| LargeMemoryClass |
Return the approximate per-application memory class of the current device when an application is running with a large heap. |
| LauncherLargeIconDensity |
Get the preferred density of icons for the launcher. |
| LauncherLargeIconSize |
Get the preferred launcher icon size. |
| LockTaskModeState |
Return the current state of task locking. |
| MemoryClass |
Return the approximate per-application memory class of the current device. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| ProcessesInErrorState |
Returns a list of any processes that are currently in an error condition. |
| RunningAppProcesses |
Returns a list of application processes that are running on the device. |
| ThresholdClass |
Provides JNI binding infrastructure for Android.App.ActivityManager. |
| ThresholdType |
Provides JNI binding infrastructure for Android.App.ActivityManager. |
Methods
| Name | Description |
|---|---|
| AddApplicationStartInfoCompletionListener(IExecutor, IConsumer) |
Adds a callback that is notified when the |
| AddAppTask(Activity, Intent, ActivityManager+TaskDescription, Bitmap) |
Add a new AppTask for the calling application. |
| AddStartInfoTimestamp(Int32, Int64) |
Adds an optional developer supplied timestamp to the calling apps most recent
|
| AppNotResponding(String) |
Method for the app to tell system that it's wedged and would like to trigger an ANR. |
| ClearApplicationUserData() |
Permits an application to erase its own data from disk. |
| ClearWatchHeapLimit() |
Clear a heap watch limit previously set by |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| DumpPackageState(FileDescriptor, String) |
Perform a system dump of various state associated with the given application package name. |
| DumpPackageStateAsync(FileDescriptor, String) | |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| FromContext(Context) | |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetHistoricalProcessExitReasons(String, Int32, Int32) |
Return a list of |
| GetHistoricalProcessStartReasons(Int32) |
Return a list of |
| GetMemoryInfo(ActivityManager+MemoryInfo) |
Return general information about the memory state of the system. |
| GetMyMemoryState(ActivityManager+RunningAppProcessInfo) |
Return global memory state information for the calling process. |
| GetProcessMemoryInfo(Int32[]) |
Return information about the memory usage of one or more processes. |
| GetRecentTasks(Int32, RecentTaskFlags) | |
| GetRunningServiceControlPanel(ComponentName) |
Returns a PendingIntent you can start to show a control panel for the given running service. |
| GetRunningServices(Int32) |
Return a list of the services that are currently running. |
| GetRunningTasks(Int32) |
Obsolete.
Return a list of the tasks that are currently running, with the most recent being first and older ones after in order. |
| IsActivityStartAllowedOnDisplay(Context, Int32, Intent) |
Check if the context is allowed to start an activity on specified display. |
| JavaFinalize() |
Obsolete.
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| KillBackgroundProcesses(String) |
Have the system immediately kill all background processes associated with the given package. |
| MoveTaskToFront(Int32, Int32) | |
| MoveTaskToFront(Int32, MoveTaskFlags, Bundle) |
Ask that the task associated with a given task ID be moved to the front of the stack, so it is now visible to the user. |
| MoveTaskToFront(Int32, MoveTaskFlags) |
Equivalent to calling |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| RegisterAnrWarningListener(IExecutor, IConsumer) |
Registers a listener that is called when the app is close to the ANR timeout. |
| RemoveApplicationStartInfoCompletionListener(IConsumer) |
Removes the provided callback set by |
| RestartPackage(String) |
Obsolete.
This method was deprecated in API level 15. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| SetProcessStateSummary(Byte[]) |
Set custom state data for this process. |
| SetVrThread(Int32) |
Enable more aggressive scheduling for latency-sensitive low-runtime VR threads. |
| SetWatchHeapLimit(Int64) |
Request that the system start watching for the calling process to exceed a pss size as given here. |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterAnrWarningListener(IConsumer) |
Unregisters a previously registered ANR warning listener. |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |