Android Get Processor Model

后端 未结 2 1269
感动是毒
感动是毒 2021-02-04 17:53

I want to get Processor Model similar to DU Booster. CPU model contains ARM processor version and revision. For Example: ARMv7 Processor rev 3 (v7l)

I have tried this

2条回答
  •  甜味超标
    2021-02-04 18:27

    This is an easy way to do so, you can do it with Patterns but that would require alot of TaE (Trial and Error)

    String unparsed_CPU_INFO;
    
    onCreate{
    
            // cpu info
                        String result = null;
                        CMDExecute cmdexe = new CMDExecute();
                        try {
                            String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
                            result = cmdexe.run(args, "/system/bin/");
                            Log.i("result", "result=" + result);
                        } catch (IOException ex) {
                            ex.printStackTrace();
                        }
    
    
                        unparsed_CPU_INFO = result;
    
    System.out.println("Your cpu model is: " ++ getCPUName());
    }
    
        public synchronized String getCPUName() {
                    if (cpuName == null) {
                        String CPUName = "";
    
                        String[] lines = unparsed_CPU_INFO.split("\n");
    
                        for (int i = 0; i < lines.length; i++) {
    
                            String temp = lines[i];
    
                            if (lines[i].contains("Processor\t:")) {
    
                                CPUName = lines[i].replace("Processor\t: ", "");
                                break;
                            }
                        }
                        cpuName = CPUName;
                        return CPUName;
                    } else {
                        return cpuName;
                    }
                }
    

提交回复
热议问题