(String name)
| 135 | } |
| 136 | |
| 137 | public static String getMac(String name) { |
| 138 | try { |
| 139 | StringBuilder sb = new StringBuilder(); |
| 140 | NetworkInterface nif = NetworkInterface.getByName(name); |
| 141 | if (nif.getHardwareAddress() == null) return ""; |
| 142 | for (byte b : nif.getHardwareAddress()) sb.append(String.format("%02X:", b)); |
| 143 | return substring(sb.toString()); |
| 144 | } catch (Exception e) { |
| 145 | return ""; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | public static String getDeviceName() { |
| 150 | String model = Build.MODEL; |