java - Android后台服务如何非root权限下获取手机当前状态信息?
PHPz
PHPz 2017-04-18 10:53:43
0
2
1048

我想写一个后台服务,每隔固定时间收集一次手机当前状态信息,包括内存使用情况,CPU使用情况,以及各个进程使用的资源占比。(看Linux进程也可以接受)

adb工具好像只能用来开发调试,用Linux内核的命令好像又权限不够。所以来提问。

先谢过各位了!


已经找到解决方法了,如果有其他方法欢迎大家补充!

PHPz
PHPz

学习是最好的投资!

reply all(2)
黄舟

First of all, thank you for the first answer @didikee

Following this idea, I found an Android Process class. This class seems to obtain various process information by reading the information in the proc folder. Please go to github for details.

Another: Extended reading

PHPzhong

1.CPU frequency, CPU information: /proc/cpuinfo/proc/stat
2.内存:/proc/meminfo
3.proc/This information file in the directory is only readable, not writable.

I took a screenshot, you can take a look for yourself: (Of course I hope you can take a look with your phone)

Reference: http://www.cnblogs.com/brainy/archive/2012/05/30/2526752.html

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template