如何获取android后台运行进程的详细信息 [英] How to get android background running process details

查看:917
本文介绍了如何获取android后台运行进程的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想列出所有后台运行的进程,并从一个后台服务(没有UI)获得这些进程的详细信息.详细信息如下:

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

我可以获得后台运行进程的列表,但如何获取内存使用情况,它们正在访问的文件以及文件的上次修改时间. 是否可以在API级别实现?有人可以指导我如何执行此操作吗?任何人都可以给我想法或建议与此相关的有用链接.

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.

推荐答案

正在运行的服务UI使用 getProcessMemoryInfo getRunningServices .

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

请注意,这些仅告诉您有关高级系统正在管理的Java进程的信息; getRunningAppProcesses将不返回有关低级守护进程的信息.

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.

内核具有/proc下打开文件的信息,但是除非您以root用户身份运行,否则您将无法获得有关另一个进程的信息.

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.

所有当前正在运行的进程也位于/proc下,但请注意/proc不是Android SDK的一部分,并且不能保证您的应用程序可以在所有设备或平台版本上使用./proc是私有的实现细节.

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.

这篇关于如何获取android后台运行进程的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆