I am developing an Android App, where I have to display RAM consumption by each app running on the device as a foreground and background, I have gone through multiple solutions, but they only talk about total RAM and available RAM, So my queries are
- Is there any public API available? I didn't find much in the Android Official document.
- Is it possible through System APP then how?
- Is there any private API available in the framework? I can modify my framework as well, but don't know where.
ActivityManager.getProcessMemoryInfo (int[] pids) is public API. However,
You can see
Settings -> System -> Developer Options (You need to enable the Developer Options) -> Memory -> Memory used by apps
how to do this.Settings app uses
com.android.internal.app.procstats.ProcessStats
,ActivityManager.getProcessMemoryInfo
usesProcessStats
to implement.