AndroidMemoryPressure
Implementation of MemoryPressure for Android.
In the Android system, ComponentCallbacks2 is used to monitor memory pressure states. It notifies the memory pressure state based on the level parameter of ComponentCallbacks2.onTrimMemory.
| Android Trim Level | MemoryPressureLevel |
|:-------------------------------|:----------------------|
| TRIM_MEMORY_UI_HIDDEN | Low |
| TRIM_MEMORY_BACKGROUND | Low |
| TRIM_MEMORY_MODERATE | Low |
| TRIM_MEMORY_RUNNING_MODERATE | Low |
| TRIM_MEMORY_RUNNING_LOW | Low |
| TRIM_MEMORY_COMPLETE | Critical |
| TRIM_MEMORY_RUNNING_CRITICAL | Critical |
Content copied to clipboard
Functions
Link copied to clipboard
Registers a listener to receive events.
Link copied to clipboard
Converts this Listenable into a Flow that emits events.
Link copied to clipboard
Checks if there are any registered listeners.
Link copied to clipboard
Notifies all registered listeners about an event.
Link copied to clipboard
Unregisters a listener from receiving events.