MCPcopy Create free account
hub / github.com/FongMi/TV / getMac

Method getMac

app/src/main/java/com/fongmi/android/tv/utils/Util.java:137–147  ·  view source on GitHub ↗
(String name)

Source from the content-addressed store, hash-verified

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;

Callers 1

getMethod · 0.95

Calls 4

substringMethod · 0.95
appendMethod · 0.45
formatMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected