Balaji Khadake
Balaji Khadake

Reputation: 3479

How to get android background running process details

I want to list all background running processes and get details of those from one background service(Without UI). Details are as follows:

1. Name
2. Memory usage
3. Application related to process
4. Files they are accessing
5. Last modified time of files

I can get list of background running processes but how to get memory usage, Files they are accessing and Last modified time of files. Is this possible to implement at API level? Can anyone guide me How to do this? Can anybody give me idea or suggest useful link related to this.

Upvotes: 7

Views: 14763

Answers (2)

ANUP
ANUP

Reputation: 185

With following line of code you can get currently running services list

ActivityManager localActivityManager = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);

List RunningServiceInfoservices = localActivityManager.getRunningServices(100);

And from RunningServiceInfo you can get details for the process. http://developer.android.com/reference/android/app/ActivityManager.RunningServiceInfo.html

Upvotes: 4

hackbod
hackbod

Reputation: 91351

The Running Services UI uses getRunningAppProcesses, getProcessMemoryInfo, and getRunningServices.

Note that these only tell you about Java processes being managed by the high-level system; getRunningAppProcesses will not return information about low-level daemon processes.

The kernel has information about open files under /proc, but you can not get the information about another process unless you are running as root.

Also all currently running processes are under /proc, but please note that /proc is not a part of the Android SDK and there are no guarantees that your application will work across all devices or versions of the platform if using that. /proc is a private implementation detail.

Upvotes: 9

Related Questions