This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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