Skip to content

Instantly share code, notes, and snippets.

@Morfly
Last active November 8, 2022 01:57
Embed
What would you like to do?
import android.os.Debug.MemoryInfo
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val pid = intArrayOf(android.os.Process.myPid())
// The sample rate for calling this API is limited to once per 5 minutes.
// If called more frequently, it returns the same data as pverious call.
val memoryInfo: MemoryInfo = activityManager.getProcessMemoryInfo(pid).first()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment