Maybe I'm asking the wrong question, but I can't seem to find what I'm looking for, so I'll try ask it here instead of google.
Basically, I have the following code, from which I can glean if I am on wifi, 3G or something else (tethering comes to mind).
// Iterate over all network interfaces.
for (Enumeration<NetworkInterface> en =
NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
{
NetworkInterface intf = en.nextElement();
// Iterate over all IP addresses in each network interface.
for (Enumeration<InetAddress> enumIPAddr =
intf.getInetAddresses(); enumIPAddr.hasMoreElements();)
{
InetAddress iNetAddress = enumIPAddr.nextElement();
// Loop back address (127.0.0.1) doesn't count as an in-use
// IP address.
if (!iNetAddress.isLoopbackAddress())
{
sLocalIP = iNetAddress.getHostAddress().toString();
sInterfaceName = intf.getName();
}
}
}
I believe the important part here is sInterfaceName = intf.getName();
Now on the Galaxy S and Galaxy S Tab, this seems to return "eth0" when you are connected to WiFi and "pdp0" when connected to 3G
That said, I've only really been able to test with 1 x Galaxy S and 1 x Galaxy S Tab as they are the only Android devices I have. I imagine the network interface name is set somewhere in the kernel by the device manager. I could probably troll through the kernel for each device, but I figured someone must have found this info out already, any suggestions on where to look or what to search in google?