Hi there...
is a continue of:
https://www.b4x.com/android/forum/threads/get-a-unique-id-of-a-device.84189/#post-533568
That is ok printing at logs ... but when tried to have in string not coming into it :-(
Seems that i must change something to java... but can't find what - anyone can help... ?
is a continue of:
https://www.b4x.com/android/forum/threads/get-a-unique-id-of-a-device.84189/#post-533568
B4X:
Sub AppStart (Form1 As Form, Args() As String)
Dim jo As JavaObject = Me
jo.RunMethod("PrintAllInterfaces", Null)
End Sub
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
#if JAVA
import java.net.NetworkInterface;
import java.util.Enumeration;
public static void PrintAllInterfaces() throws Exception {
for (Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();)
{
NetworkInterface network = e.nextElement();
byte[] mac = network.getHardwareAddress();
if (mac != null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
}
//Interface properties
System.out.println("Current MAC address : " + sb.toString() +"\r\n");
System.out.println(network.getDisplayName());
System.out.println(network.getName());
}
}
}
#End If
That is ok printing at logs ... but when tried to have in string not coming into it :-(
B4X:
Sub getmacs As String
Dim jo As JavaObject = Me
Return jo.RunMethod("PrintAllInterfaces", Null)
End Sub
Seems that i must change something to java... but can't find what - anyone can help... ?