You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Chris Ellem <ch...@gmail.com> on 2015/09/01 07:17:15 UTC

Missing android WiFi setting

Hi guys,

can we please add the missing android..gateway WiFi information to the
retrieved Network parameters in the next SDK build.

Unfortunately we can't detect this information and connect dynamically to
the active WiFi network.

android parameter...getprop dhcp.wlan0.gateway

http://stackoverflow.com/questions/6288243/get-gateway-ip-address-in-android

presently....we use the code below to get the network info..but the most
important IP is missing..if we could add the gateway info to the
findInterfaces() function that would be awesome.

if anyone has a WiFi native extension that would be great as well.

import flash.net.NetworkInfo;

public function findInterface():void {
				trace('findInterface');
				var results:Vector.<NetworkInterface> =
NetworkInfo.networkInfo.findInterfaces();
				trace('findInterface results.length '+results.length);
				
				for (var i:int=0; i<results.length; i++){
					
					if(results[i].name == 'WIFI'){					
						var output = output
							+ "Name: " + results[i].name + "\n"
							+ "DisplayName: " + results[i].displayName + "\n"
							+ "MTU: " + results[i].mtu + "\n"
							+ "HardwareAddr: " + results[i].hardwareAddress + "\n"
							+ "Active: "  + results[i].active + "\n"
							+ "Parent: "  + results[i].parent + "\n";;
						
						
						for (var j:int=0; j<results[i].addresses.length; j++)	{
							output = output
								//+ "DisplayName: " + results[i].addresses[j].displayName + "\n"
								+ "Addr: " + results[i].addresses[j].address + "\n"
								+ "Broadcast: " + results[i].addresses[j].broadcast + "\n"
								//+ "Gateway: " + results[i].addresses[j].gateway + "\n"
								+ "PrefixLength: " + results[i].addresses[j].prefixLength + "\n"
								+ "IPVersion: " + results[i].addresses[j].ipVersion + "\n";
						}	
						
						try{
							for (var k:int=0; k<results[i].subInterfaces.length; k++)	{
								output = output
									//+ "DisplayName: " + results[i].addresses[k].displayName + "\n"
									+ "Addr: " + results[i].addresses[k].address + "\n"
									+ "Broadcast: " + results[i].addresses[k].broadcast + "\n"
									+ "PrefixLength: " + results[i].addresses[k].prefixLength + "\n"
									+ "IPVersion: " + results[i].addresses[k].ipVersion + "\n";
							}
						}catch(e:Error){
							trace('no sub addresses');							
						}
						
						
					
					}
					output = output + "\n";					
					trace('output'+output);
					
				}
			}

Thanks

Chris



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Missing-android-WiFi-setting-tp11106.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.