Android Question net.hostname with reflector

energeticaserranopolis

New Member
Licensed User
Longtime User
Hello, I found this code that returns the net.hostname. I need to adapt it for use with B4a.
Can anyone help me?

Public static String getHostName(String defValue) {
Try {
Method getString = Build.class.getDeclaredMethod("getString", String.class);
getString.setAccessible(True);
Return getString.invoke(Null, "net.hostname").toString();
} catch (Exception ex) {
return defValue;
}
}


Thank you.
 
Top