一.使用
权限
1.2.cat proc/cpuinfo | grep Seria
public String getCPUinfo() {
String cpuAddress = "0000000000000000";
String cmd = "cat /proc/cpuinfo";
try {
Process p = Runtime().exec(cmd);
String data = null;
BufferedReader ie = new BufferedReader(new ErrorStream()));
BufferedReader in = new BufferedReader(new InputStream()));
String error = null;
while ((error = ie.readLine()) != null && !error.equals("null")) {
data += error + "
";
}
String line = null;
while ((line = in.readLine()) != null && !line.equals("null")) {
data += line + "
";
// Log.d("gatsby", "CPUinfo line->" + line);
if (ains("Serial:")) {
String[] SerialStr = line.split(":");
if (SerialStr.length == 2) {
String mSerial = SerialStr[1];
// Cpu 序列号
// Log.d("gatsby", "CPUinfo mSerial ->" + im());
cpuAddress = im();
return cpuAddress;
}
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
return cpuAddress;
}
本文发布于:2024-01-31 07:40:56,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170665805726776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |