Android.App.Application.OnTrimMemory Method
Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.

Syntax

[Android.Runtime.Register("onTrimMemory", "(I)V", "GetOnTrimMemory_IHandler")]
public virtual void OnTrimMemory (Android.Content.TrimMemory level)

Parameters

level
The context of the trim, giving a hint of the amount of trimming the application may like to perform. May be Android.Content.ComponentCallbacks2.TrimMemoryComplete, Android.Content.ComponentCallbacks2.TrimMemoryModerate, Android.Content.ComponentCallbacks2.TrimMemoryBackground, Android.Content.ComponentCallbacks2.TrimMemoryUiHidden, Android.Content.ComponentCallbacks2.TrimMemoryRunningCritical, Android.Content.ComponentCallbacks2.TrimMemoryRunningLow, or Android.Content.ComponentCallbacks2.TrimMemoryRunningModerate.

Remarks

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process. This will happen for example when it goes in the background and there is not enough memory to keep as many background processes running as desired. You should never compare to exact values of the level, since new intermediate values may be added -- you will typically want to compare if the value is greater or equal to a level you are interested in.

To retrieve the processes current trim level at any point, you can use ActivityManager.GetMyMemoryState(.RunningAppProcessInfo).

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 14