However, I cant for the life of me figure out the word to use in the get_environment() function to get the android Hostname to then get the IP address of the phone.
Does anyone know the environment name that holds the android hostname?
You can get the hostname of your android device using
OS.execute("getprop" , ["net.hostname"] , false)
That’ll output an array containing the host name, which you can then convert to a string.
I’m not close to my PC currently so I can’t test this, but it should be a start.
I tried this, but there are some problems.
OS.Execute() only returns an “int” not and array.
if I add the code:
var output = [];
OS.execute("getprop" , new[]{"net.hostname"} , false, output);
I get an empty array for “output”
ondesic | 2023-02-24 16:43
Sorry I didn’t specify the output array.
The issue though, is from android, or rather the difference in manufacturer implementation. Because on my device, it returns the hostname as expected, meanwhile, on another device, it returns an empty array because the net.hostname property is not set on that device.