berk şahin
berk şahin

Reputation: 43

How get android cpu model name?

I want to learn my phone cpu model name and I tryed to use /proc/cpuinfo and a lot of code but I failed. Can anyone help me?

Upvotes: 4

Views: 3960

Answers (2)

qingfei song
qingfei song

Reputation: 21

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;
}

What about your code?

Upvotes: 1

Diego Torres Milano
Diego Torres Milano

Reputation: 69388

Run

$ adb shell cat /proc/cpuinfo

Upvotes: 7

Related Questions