AS3 Get IP address of android wifi tether
i have the following code.
private function searchAvailableIP(){
var interfaces:Vector.<NetworkInterface> = NetworkInfo.networkInfo.findInterfaces();
var connectFlag:Boolean = false;
var activeIP:String;
for(var key:String in interfaces){
if(interfaces[key].active){
var addresses:Vector.<InterfaceAddress> = interfaces[key].addresses;
for(var akey:String in addresses){
activeIP = addresses[akey].address;
connectFlag = true;
break;
}
}
if(connectFlag){
break;
}
}
return activeIP;
}
This works perfectly on getting the first active WIFI IP address of my android phone, however, if my phone is on WIFI Tether mode, I am unable to get its ip address. it always returns the loop back IP which is 127.0.0.1. I checked the WIFI Tether IP of my phone, it was 192.168.43.1, how come the following code cannot detect the IP Address of the WIFI Tether?
