ramkrishna kushwaha
ramkrishna kushwaha

Reputation: 390

How to get memory (RAM/ROM) consumption details in Android?

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

Upvotes: 1

Views: 3346

Answers (1)

atyc
atyc

Reputation: 1086

ActivityManager.getProcessMemoryInfo (int[] pids) is public API. However,

As of Android Q, for regular apps this method will only return information about the memory info for the processes running as the caller's uid; no other process memory info is available and will be zero.

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 uses ProcessStats to implement.

Upvotes: 0

Related Questions