WifiManager in android gives network details for Wifi network. But it is not possible to get network details like Gateway, DNS, for 3G network. Is there a way to obtain such details for mobile connected to 3G network. Thank you
Asked
Active
Viewed 543 times
2 Answers
0
not sure but maybe this could help you.
http://developer.android.com/reference/android/net/NetworkInfo.html
note: this method: getActiveNetworkInfo(), return a NetworkInfo object with the info of the active connection on device (3G - Wifi).

jac1013
- 408
- 3
- 11
-
It just gives the type of network and some other details but NOT the IP, Gateway, DNS details. JAVA reflection could be helpful but don't know how this works. – nis May 28 '13 at 06:12
-
i don't get how reflection could help you on this, anyway i found this http://stackoverflow.com/questions/5945288/get-default-gatway-in-java – jac1013 May 28 '13 at 15:21
-
traceroute doesn't work in android. so getting first hop from traceroute to determine gateway doesn't fit for android – nis Jun 01 '13 at 08:19
-
well, via android i don't think you could get that info, `ifconfig` won't work either since that command need `root` permission, let me know if you find the way to do it. Regards. – jac1013 Jun 01 '13 at 17:07
-
netcfg in adb shell displays ip address. Is there a way to execute the command and parse the output? – nis Jun 02 '13 at 06:11
-
seems like you can run `root` commands http://stackoverflow.com/questions/6882248/running-shell-commands-though-java-code-on-android and well if it doesn't work try at least without `su` the `netcfg` command, in that post it's explained how to get the data from the command line. – jac1013 Jun 02 '13 at 16:51
0
If you install Terminal Emulator and BusyBox, you have ifconfig and ip available.
In the emulator you can use "ip link show" to find out what designation is used for the device. WLAN is usually : wlan0 Modem etc : rmnet0
ifconfig wlan0 : show you for example the ip and the netmask .
ip route show : shows you the routing configuration .
Better description: Network configuration and information

Wiffzack
- 315
- 3
- 10