Android examples for android.os:CPU
get CPU Serial from /proc/cpuinfo
import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; public class Main { public static String getCPUSerial() { String str = "", strCPU = "", cpuAddress = "0000000000000000"; Process pp = null;//from w w w .j a v a2s.c o m InputStreamReader ir = null; LineNumberReader input = null; try { pp = Runtime.getRuntime().exec("cat /proc/cpuinfo"); ir = new InputStreamReader(pp.getInputStream()); input = new LineNumberReader(ir); for (int i = 1; i < 100; i++) { str = input.readLine(); if (str != null) { if (str.indexOf("Serial") > -1) { strCPU = str.substring(str.indexOf(":") + 1, str.length()); cpuAddress = strCPU.trim(); break; } } else { break; } } } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException ex) { ex.printStackTrace(); } input = null; } if (ir != null) { try { ir.close(); } catch (IOException ex) { ex.printStackTrace(); } ir = null; } if (pp != null) { pp.destroy(); pp = null; } } return cpuAddress; } }