Android.Content.IComponentCallbacks2.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:Android.Content.IComponentCallbacks2Invoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnTrimMemory ([Android.Runtime.GeneratedEnum] 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 ComponentCallbacks2.TrimMemoryComplete, ComponentCallbacks2.TrimMemoryModerate, ComponentCallbacks2.TrimMemoryBackground, ComponentCallbacks2.TrimMemoryUiHidden, ComponentCallbacks2.TrimMemoryRunningCritical, ComponentCallbacks2.TrimMemoryRunningLow, or 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 Android.App.ActivityManager.GetMyMemoryState(.RunningAppProcessInfo).

[Android Documentation]

Requirements

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