1

有没有办法以编程方式检索 ARM 处理器版本?我正在尝试将其发送到 Google Analytics。我被告知它在 /proc/cpuinfo 文件夹中,但我不确定如何在代码中检索此信息。

4

1 回答 1

7

来自http://android-er.blogspot.com/2009/09/read-android-cpu-info.html

private String ReadCPUinfo()
 {
  ProcessBuilder cmd;
  String result="";

  try{
   String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
   cmd = new ProcessBuilder(args);

   Process process = cmd.start();
   InputStream in = process.getInputStream();
   byte[] re = new byte[1024];
   while(in.read(re) != -1){
    System.out.println(new String(re));
    result = result + new String(re);
   }
   in.close();
  } catch(IOException ex){
   ex.printStackTrace();
  }
  return result;
 }

您可以只split对结果中的每一行执行并查找以 . 开头的行Processor

于 2011-07-11T20:57:18.200 回答