android獲取硬體資訊

2021-06-22 04:28:59 字數 1345 閱讀 8903

1.獲取cpu型號

private static string getcpuname()

return array[1];

}catch(filenotfoundexecption e)catch (ioexception e)

return null;

}

2.獲取cpu核心數

private int getnumcores() 

return false;

}

}try catch(exception e)

}

3.獲取cpu最大頻率

public static string getmincpufreq() ;  

cmd = new processbuilder(args);

process process = cmd.start();

inputstream in = process.getinputstream();

byte re = new byte[24];

while (in.read(re) != -1)

in.close();

} catch (ioexception ex)

return result.trim();

}

4.ram記憶體大小

private long getrammemory(context context)

initial_memory = integer.valueof(arrayofstring[1]).intvalue() * 1024;// 獲得系統總記憶體,單位是kb,乘以1024轉換為byte

localbufferedreader.close();

} catch (ioexception e)

//return formatter.formatfilesize(context, initial_memory);// byte轉換為kb或者mb,記憶體大小規格化

system.out.println("總運存--->>>"+initial_memory/(1024*1024));

return initial_memory/(1024*1024);

}

5.rom大小

public long gettotalinternalmemorysize()
6.獲取螢幕解析度

private string getscreenresolution()

android 獲取系統硬體資訊

一,首先設定許可權訪問 二,邏輯 獲取系統硬體資訊 package com.wangfubin.getmyphoneinformation import org.w3c.dom.userdatahandler import android.r.id import android.annotation...

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...

c 獲取硬體資訊

using system using system.runtime.interopservices using system.management namespace hardware 取cpu編號 public string getcpuid return strcpuid catch end m...