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

      

  • 相关阅读:
    MS-DOS命令
    寻找一条通过迷宫的路径
    linux文件基本操作和常用命令
    网络基础
    计算机基础---操作系统
    GIT 使用
    计算机基础
    秒角士网站
    咖啡项目
    winfrom面向对象1
  • 原文地址:https://www.cnblogs.com/crushgirl/p/14276389.html
Copyright © 2011-2022 走看看