AndroidMemoryPressureObserver
class AndroidMemoryPressureObserver(context: Context) : ManualMemoryPressureObserver, AutoCloseable(source)
MemoryPressureObserver driven by Android's ComponentCallbacks2.onTrimMemory / onLowMemory.
Registers on the application context at construction; close unregisters it (idempotent).
Parameters
context
any context; its application context is used.
Properties
Link copied to clipboard
The most recently reported level, or MemoryPressureLevel.NORMAL if none has been reported.
Functions
Link copied to clipboard
Registers listener. Closing the returned handle unregisters it; closing it more than once is a no-op.
Link copied to clipboard
Unregisters from the application context. Idempotent.
Link copied to clipboard
Records newLevel as currentLevel and notifies every registered listener in registration order.