我想寫一個(gè)后臺(tái)服務(wù),每隔固定時(shí)間收集一次手機(jī)當(dāng)前狀態(tài)信息,包括內(nèi)存使用情況,CPU使用情況,以及各個(gè)進(jìn)程使用的資源占比。(看Linux進(jìn)程也可以接受)
adb工具好像只能用來(lái)開發(fā)調(diào)試,用Linux內(nèi)核的命令好像又權(quán)限不夠。所以來(lái)提問(wèn)。
先謝過(guò)各位了!
已經(jīng)找到解決方法了,如果有其他方法歡迎大家補(bǔ)充!
學(xué)習(xí)是最好的投資!
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
1.CPU frequency, CPU information: /proc/cpuinfo
和/proc/stat
2.內(nèi)存:/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