If you can use the Mango SDK (7.1), and if your script involves using sockets, there is a trivial way to get the NetworkInterfaceType / SubType information for the connection you just made:
NetworkInterfaceInfo netInterfaceInfo = socket.GetCurrentNetworkInterface(); var type = netInterfaceInfo.InterfaceType; var subType = netInterfaceInfo.InterfaceSubtype;
No need to use the NetworkInterface.NetworkInterfaceType property (which, as you know, takes up to 30 seconds to return); there is no need to run host name resolution to determine the type of network; no need to listen to network change events.
Of course, this works best when combined with DeviceNetworkInformation.IsNetworkAvailable or NetworkInterface.GetIsNetworkAvailable () - these calls return immediately regardless of whether you are online or not. If so, first plug in the socket and ask questions when it's plugged in :-)
Final note: be careful with Mango DeviceNetworkInformation.IsWiFiEnabled - I thought it would return if I was on a Wi-Fi network, but instead it will turn Wi-Fi on or off in the phone settings ... not super useful.
Omri gazitt
source share