zoukankan      html  css  js  c++  java
  • Android CPU序列号(CPU id)

    https://blog.csdn.net/awenshim/article/details/104847251 

    一.使用

    1.1.root 权限

    1.2.cat proc/cpuinfo | grep Seria

    	public String getCPUinfo() {
    		String cpuAddress = "0000000000000000";
    		String cmd = "cat /proc/cpuinfo";
    		try {
    			Process p = Runtime.getRuntime().exec(cmd);
    
    			String data = null;
    			BufferedReader ie = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    			BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
    			String error = null;
    
    			while ((error = ie.readLine()) != null && !error.equals("null")) {
    				data += error + "
    ";
    			}
    
    			String line = null;
    
    			while ((line = in.readLine()) != null && !line.equals("null")) {
    				data += line + "
    ";
    				// Log.d("gatsby", "CPUinfo line->" + line);
    				if (line.contains("Serial		:")) {
    					String[] SerialStr = line.split(":");
    					if (SerialStr.length == 2) {
    						String mSerial = SerialStr[1];
    						// Cpu 序列号
    						// Log.d("gatsby", "CPUinfo mSerial ->" + mSerial.trim());
    						cpuAddress = mSerial.trim();
    						return cpuAddress;
    					}
    				}
    			}
    		} catch (IOException ioe) {
    			ioe.printStackTrace();
    		}
    		return cpuAddress;
    	}
    

      

  • 相关阅读:
    排球运动规则简介
    我与计算机
    我和电脑的不解之缘
    作业
    怎样成为一个高手 观后感
    本周作业
    作业个人
    本周作业
    本周总结
    本周总结(13周)
  • 原文地址:https://www.cnblogs.com/crushgirl/p/14276389.html
Copyright © 2011-2022 走看看