private String getMac() {                String macSerial = null;                String str = "";                try {                        Process pp = Runtime.getRuntime().exec(                                        "cat /sys/class/net/wlan0/address ");                        InputStreamReader ir = new InputStreamReader(pp.getInputStream());                        LineNumberReader input = new LineNumberReader(ir);                        for (; null != str;) {                                str = input.readLine();                                if (str != null) {                                        macSerial = str.trim();// 去空格                                        break;                                }                        }                } catch (IOException ex) {                        // 赋予默认值                        ex.printStackTrace();                }                return macSerial;        }

創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()