Compartir a través de


ActivityManager Class

Definition

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
ActivityManager
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, android.app.ActivityManager#isLowRamDevice() isLowRamDevice() enables your app to detect whether it is running on a low-memory device, and behave accordingly. android.app.ActivityManager#clearApplicationUserData() 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 android.app.ActivityManager.AppTask and android.app.ActivityManager.RecentTaskInfo inner classes. However, in general, the methods in this class should be used for testing and debugging purposes only.

Java documentation 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

ActivityManager(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ActionReportHeapLimit

Action an app can implement to handle reports from #setWatchHeapLimit(long).

MetaHomeAlternate <meta-data> name for a 'home' Activity that declares a package that is to be uninstalled in lieu of the declaring one.

Properties

AppTasks

Get the list of tasks associated with the calling application.

AppTaskThumbnailSize

Return the current design dimensions for AppTask thumbnails, for use with #addAppTask.

Class

Returns the runtime class of this Object.

(Inherited from Object)
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

Return whether currently in lock task mode.

IsLowMemoryKillReportSupported
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 (Inherited from Object)
JniPeerMembers
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 (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

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AddAppTask(Activity, Intent, ActivityManager+TaskDescription, Bitmap)

Add a new AppTask for the calling application.

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 #setWatchHeapLimit(long).

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DumpPackageState(FileDescriptor, String)

Perform a system dump of various state associated with the given application package name.

DumpPackageStateAsync(FileDescriptor, String)
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 ApplicationExitInfo records containing the reasons for the most recent app deaths.

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()

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 #moveTaskToFront(int, int, Bundle) with a null options argument.

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)
RestartPackage(String)
Obsolete.

This member is deprecated.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
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>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (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

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to