connection - getting router ipv4 adress to android device -


i need router ipv4 adress android phone. possible that? it's easy ipv4 computer jus need type ipconfig cmdenter image description here

but how connected router ipv4 android device? here's android code connect router

 @override     public void onreceive(context context, intent intent) {         list<scanresult> list = scanner.getscanresults();          for(scanresult result : list){             if(result.ssid.equals("micro")){                 //connect network                 connect(result.ssid);                 break;             }         }     }      public void connect(string name){         string password = "logitech";         wificonfiguration conf = new wificonfiguration();         conf.ssid = "\"" + name + "\"";         conf.presharedkey = "\""+ password +"\"";          scanner.addnetwork(conf);          list<wificonfiguration> list = scanner.getconfigurednetworks();         for( wificonfiguration : list ) {             if(i.ssid != null && i.ssid.equals("\"" + name + "\"")) {                  int neiid = list.get(0).networkid;                  log.d(tag, "" + neiid);                 scanner.disconnect();                 scanner.enablenetwork(i.networkid, true);                 scanner.reconnect();                 break;             }         }     } 

after search i've found line should getprop net.dns1

it gets dns server , if haven't set other default gateway, default gateway, , if haven't set default gateway other router, default gateway router, , unless specified ipv6, ip denotes ipv4.

hope helps

sources :get gateway ip address in android, what dns server


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -