1

I have to create an application that is able to gather data about cpu, ram and network usage of all applications installed on the device. Is there any Android API to get this info? I have not find any. ActivityManager is able to provide data only about the application in which it is used. Do you know any way to resolve my problem?

[EDIT] I probably was not precise enough. What I am trying to achieve is to get a list of applications with statistics of the memory and network usage of each application. Not the overall statistics of all applications. I will have to rate those applications according to gathered data so I need separated data for each application.

Macple
  • 41
  • 11
  • Have you already looked for questions about that? I think [this thread](http://stackoverflow.com/a/3192348/3593126) has some good informations – Max Klein May 04 '15 at 13:22
  • [Here](http://stackoverflow.com/q/3118234/3593126) is also some good information – Max Klein May 04 '15 at 13:25
  • This information is ok but I am looking for data according to each particular application, not combined memory usage. – Macple May 13 '15 at 08:52
  • You could try to parse the output of the `ps` shell command. More information on `ps` can be found [here](http://linux.about.com/od/commands/l/blcmdl1_ps.htm). Use `Runtime.getRuntime().exec("ps");` ([Runtime#exec(String)](http://developer.android.com/reference/java/lang/Runtime.html#exec(java.lang.String))) to execute the command from your android app. – Max Klein May 13 '15 at 15:08
  • `ps` on android is different from the standard linux one, [look here](http://codeseekah.com/2012/10/21/android-shell-tricks-ps/) for the available parameters (use `-c` to get the cpu usage) – Max Klein May 13 '15 at 15:15

1 Answers1

0
MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
long availableMegs = mi.availMem / 1048576L;

Try this to get Memory Information. Here is the reference.

Bullionist
  • 2,070
  • 3
  • 25
  • 42
  • I was not looking for these kind of information. I am trying to get data about each particular application not overall ram usage. – Macple May 13 '15 at 08:51