Android中獲取手機cpu序列號

2021-06-18 10:21:55 字數 1058 閱讀 2556

這一篇**主要講的的是android裡獲取手機cpu序列號,**很少,也應該算很簡單了。下面來看看**:

/**

* 獲取cpu序列號

* @return cpu序列號(16位)

* 讀取失敗為"0000000000000000"

*/public

static

string

getcpuserial(){

string

str =""

,strcpu =""

,cpuaddress

="0000000000000000"

;try

{// 讀取cpu資訊

process

pp =

runtime

.getruntime

().exec

("cat /proc/cpuinfo"

);inputstreamreader

ir =

newinputstreamreader(pp

.getinputstream

());

linenumberreader

input

=new

linenumberreader(ir

);// 查詢cpu序列號

for(

inti =1

;i <

100;

i++)

{str

=input

.readline

();if

(str

!=null){

// 查詢到序列號所在行if(

str.

indexof

("serial"

)>-1

){// 提取序列號

文章摘自   android中獲取手機cpu序列號

Android如何實現獲取手機CPU的溫度

在做專案過程中,有時需要獲取手機cpu的溫度。目前市面上常見的cpu主要有兩種 mtk 聯發科 qualcomm 高通 當然還有我們華為的海思麒麟cpu,以及三星的cpu。後兩種cpu在本篇文章中就不做展開,有興趣的同學,可以自行去研究研究。1 開啟終端命令視窗,如windows下的cmd程式。2 ...

獲取android手機的CPU的使用率

通過獲取cpu一行的資料,即可進行cpu佔用率的計算。我們會用到的資料有 user 21441 從系統啟動開始累計到當前時刻,處於使用者態的執行時間,不包含nice值為負的程序。nice 3634 從系統啟動開始累計到當前時刻,nice值為負的程序所占用的cpu時間。system 13602 從系統...

android中獲取手機解析度

在activity中 me722 測試 480 854 豎屏 display display this.getwindowmanager getdefaultdisplay int nheight display.getheight 569 int nwidth display.getwidth 3...