How to get Android cpu model name?

I want to find out the cpu phone model name and I tried using / proc / cpuinfo and a lot of code, but I failed. Can anyone help me?

+3


source to share


2 answers


Run



$ adb shell cat /proc/cpuinfo

      

+5


source


Here is my code

public static String getCpuName() {
    try {
        FileReader fr = new FileReader("/proc/cpuinfo");
        BufferedReader br = new BufferedReader(fr);
        String text = br.readLine();
        br.close();
        String[] array = text.split(":\\s+", 2);
        if (array.length >= 2) {
            return array[1];
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

      



How about your code?

+1


source







All Articles